Full Code of Unitech/pm2 for AI

master ff1ca974afad cached
691 files
1.3 MB
392.0k tokens
442 symbols
1 requests
Download .txt
Showing preview only (1,520K chars total). Download the full file or copy to clipboard to get everything.
Repository: Unitech/pm2
Branch: master
Commit: ff1ca974afad
Files: 691
Total size: 1.3 MB

Directory structure:
gitextract_4g07d2ov/

├── .editorconfig
├── .gitattributes
├── .github/
│   ├── CONTRIBUTING.md
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── stale.yml
│   └── workflows/
│       └── node.js.yml
├── .gitignore
├── .mocharc.js
├── .npmignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── GNU-AGPL-3.0.txt
├── LICENSE
├── README.md
├── bin/
│   ├── pm2
│   ├── pm2-dev
│   ├── pm2-docker
│   ├── pm2-runtime
│   ├── pm2-windows
│   └── pm2.ps1
├── constants.js
├── examples/
│   ├── api-pm2/
│   │   ├── README.md
│   │   ├── api.js
│   │   └── http.js
│   ├── c-compile/
│   │   └── hello.c
│   ├── cluster-http/
│   │   ├── README.md
│   │   ├── ecosystem.config.js
│   │   ├── http-no-exit.js
│   │   └── http.js
│   ├── cluster-tcp/
│   │   ├── README.md
│   │   ├── http.js
│   │   ├── process.config.js
│   │   └── tcp.js
│   ├── custom-nodejs-version/
│   │   ├── ecosystem.config.js
│   │   └── http.js
│   ├── docker-pm2/
│   │   ├── Dockerfile
│   │   ├── README.md
│   │   └── app/
│   │       ├── app.js
│   │       ├── package.json
│   │       └── process.config.js
│   ├── echo/
│   │   ├── log.js
│   │   └── stdout.js
│   ├── ecosystem-file/
│   │   ├── README.md
│   │   ├── apps/
│   │   │   ├── connection_check.sh
│   │   │   ├── http.js
│   │   │   └── worker.js
│   │   ├── process.config.js
│   │   ├── process.json
│   │   └── process.yml
│   ├── esm/
│   │   ├── addTwo.js
│   │   ├── app.js
│   │   └── package.json
│   ├── exception/
│   │   ├── fast.js
│   │   └── slow.js
│   ├── expose-custom-metrics/
│   │   ├── README.md
│   │   ├── process-metrics.js
│   │   └── process.config.js
│   ├── expose-triggerable-functions/
│   │   ├── index.js
│   │   ├── process.yml
│   │   ├── trigger-param.js
│   │   └── trigger-ping.js
│   ├── import/
│   │   ├── circle.js
│   │   ├── index.js
│   │   └── package.json
│   ├── interact-via-stdin/
│   │   ├── README.md
│   │   └── stdin.js
│   ├── misc-examples/
│   │   ├── 001-test.js
│   │   ├── apps/
│   │   │   ├── all-pm2.json
│   │   │   ├── args.json
│   │   │   ├── auto-kill-echo.json
│   │   │   ├── cluster-pm2.json
│   │   │   ├── cron-pm2.json
│   │   │   ├── default-path-echo.json
│   │   │   ├── echo-pm2.json
│   │   │   ├── env-pm2.json
│   │   │   ├── killfast.json
│   │   │   ├── multi-pm2.json
│   │   │   └── no-name-echo.json
│   │   ├── args.js
│   │   ├── auto-restart-all.js
│   │   ├── auto-restart-threshold.js
│   │   ├── auto-save.js
│   │   ├── beforeExit.js
│   │   ├── child-echo.json
│   │   ├── child-env.js
│   │   ├── child-pm2.json
│   │   ├── child.js
│   │   ├── child.js-pm2.json
│   │   ├── child2.js
│   │   ├── client.js
│   │   ├── cwd.js
│   │   ├── echo.coffee
│   │   ├── echo.js
│   │   ├── echokill.js
│   │   ├── env.js
│   │   ├── env_args.js
│   │   ├── exec_watch.json
│   │   ├── exit.js
│   │   ├── expose_method.js
│   │   ├── graceful-exit.js
│   │   ├── harmony.js
│   │   ├── http.js
│   │   ├── infinite-recurse.js
│   │   ├── inside.js
│   │   ├── inside.json
│   │   ├── interact.js
│   │   ├── json.js
│   │   ├── kill-not-so-fast.js
│   │   ├── kill-slow.js
│   │   ├── killfast.js
│   │   ├── killslow.js
│   │   ├── killtoofast.js
│   │   ├── leak.js
│   │   ├── malformated.json
│   │   ├── modulechild.js
│   │   ├── moduleparent.js
│   │   ├── null.js
│   │   ├── package.json
│   │   ├── process.json
│   │   ├── programmatic.js
│   │   ├── require.js
│   │   ├── sendmsg.js
│   │   ├── sigint.js
│   │   ├── start-args.js
│   │   ├── stop-after5.js
│   │   ├── string-crash.js
│   │   ├── throw.js
│   │   ├── tree.js
│   │   ├── udp.js
│   │   └── wrap.js
│   ├── module-extra-meta/
│   │   ├── index.js
│   │   └── package.json
│   ├── module-test/
│   │   ├── README.md
│   │   ├── app.js
│   │   └── package.json
│   ├── npm-start/
│   │   ├── http.js
│   │   └── package.json
│   ├── pmx-test-all/
│   │   ├── elements/
│   │   │   ├── cluster.js
│   │   │   ├── counter.js
│   │   │   ├── error.js
│   │   │   ├── event.js
│   │   │   ├── histogram.js
│   │   │   ├── http.js
│   │   │   ├── log-cluster.js
│   │   │   ├── log.js
│   │   │   ├── meter.js
│   │   │   ├── metric.js
│   │   │   ├── notify.js
│   │   │   └── trace.js
│   │   └── process.config.js
│   ├── run-php-python-ruby-bash/
│   │   ├── bashscript.sh
│   │   ├── echo.php
│   │   ├── echo.py
│   │   ├── echo.rb
│   │   ├── leak-mem.py
│   │   └── process.yml
│   ├── send-msg/
│   │   ├── pm2-app.js
│   │   ├── pm2-msg.js
│   │   └── t2.js
│   ├── signal-catching/
│   │   └── graceful-http.js
│   ├── sourcemap-auto-resolve/
│   │   ├── API.js
│   │   ├── README.md
│   │   └── process.config.js
│   ├── start-a-binary/
│   │   ├── ls
│   │   └── ls.yml
│   ├── test-all-keymetrics-features/
│   │   ├── README.md
│   │   ├── actions-fibonacci.js
│   │   ├── custom_action.js
│   │   ├── custom_action_with_params.js
│   │   ├── event.js
│   │   ├── http_app.js
│   │   ├── http_transaction.js
│   │   ├── pm2_probe.js
│   │   ├── probes.js
│   │   ├── process-load.config.js
│   │   ├── process-transpose.js
│   │   ├── process.config.js
│   │   ├── scoped-actions.js
│   │   ├── test-threshold.js
│   │   └── throw.js
│   ├── treekill/
│   │   ├── app.js
│   │   └── process.json
│   ├── udp/
│   │   ├── client.js
│   │   └── server.js
│   ├── using-pm2-and-transpilers/
│   │   ├── README.md
│   │   ├── echo.coffee
│   │   ├── echo.ls
│   │   ├── echo.ts
│   │   ├── http.ts
│   │   └── node.d.ts
│   └── wait-ready/
│       ├── app.js
│       ├── ecosystem.json
│       └── http-simple.js
├── index.js
├── lib/
│   ├── API/
│   │   ├── Configuration.js
│   │   ├── Containerizer.js
│   │   ├── Dashboard.js
│   │   ├── Deploy.js
│   │   ├── Extra.js
│   │   ├── ExtraMgmt/
│   │   │   └── Docker.js
│   │   ├── Log.js
│   │   ├── LogManagement.js
│   │   ├── Modules/
│   │   │   ├── LOCAL.js
│   │   │   ├── Modularizer.js
│   │   │   ├── NPM.js
│   │   │   ├── TAR.js
│   │   │   ├── flagExt.js
│   │   │   └── index.js
│   │   ├── Monit.js
│   │   ├── Serve.js
│   │   ├── Startup.js
│   │   ├── UX/
│   │   │   ├── helpers.js
│   │   │   ├── index.js
│   │   │   ├── pm2-describe.js
│   │   │   ├── pm2-ls-minimal.js
│   │   │   └── pm2-ls.js
│   │   ├── Version.js
│   │   ├── interpreter.json
│   │   ├── pm2-plus/
│   │   │   ├── PM2IO.js
│   │   │   ├── auth-strategies/
│   │   │   │   ├── CliAuth.js
│   │   │   │   └── WebAuth.js
│   │   │   ├── helpers.js
│   │   │   ├── link.js
│   │   │   ├── pres/
│   │   │   │   ├── motd
│   │   │   │   ├── motd.update
│   │   │   │   └── welcome
│   │   │   └── process-selector.js
│   │   └── schema.json
│   ├── API.js
│   ├── Client.js
│   ├── Common.js
│   ├── Configuration.js
│   ├── Daemon.js
│   ├── Event.js
│   ├── God/
│   │   ├── ActionMethods.js
│   │   ├── ClusterMode.js
│   │   ├── ForkMode.js
│   │   ├── Methods.js
│   │   └── Reload.js
│   ├── God.js
│   ├── HttpInterface.js
│   ├── ProcessContainer.js
│   ├── ProcessContainerBun.js
│   ├── ProcessContainerFork.js
│   ├── ProcessContainerForkBun.js
│   ├── ProcessUtils.js
│   ├── TreeKill.js
│   ├── Utility.js
│   ├── VersionCheck.js
│   ├── Watcher.js
│   ├── Worker.js
│   ├── binaries/
│   │   ├── CLI.js
│   │   ├── DevCLI.js
│   │   ├── Runtime.js
│   │   └── Runtime4Docker.js
│   ├── completion.js
│   ├── completion.sh
│   ├── motd
│   ├── templates/
│   │   ├── Dockerfiles/
│   │   │   ├── Dockerfile-java.tpl
│   │   │   ├── Dockerfile-nodejs.tpl
│   │   │   └── Dockerfile-ruby.tpl
│   │   ├── ecosystem-es.tpl
│   │   ├── ecosystem-simple-es.tpl
│   │   ├── ecosystem-simple.tpl
│   │   ├── ecosystem.tpl
│   │   ├── init-scripts/
│   │   │   ├── launchd.tpl
│   │   │   ├── openrc.tpl
│   │   │   ├── pm2-init-amazon.sh
│   │   │   ├── rcd-openbsd.tpl
│   │   │   ├── rcd.tpl
│   │   │   ├── smf.tpl
│   │   │   ├── systemd-online.tpl
│   │   │   ├── systemd.tpl
│   │   │   └── upstart.tpl
│   │   ├── logrotate.d/
│   │   │   └── pm2
│   │   └── sample-apps/
│   │       ├── http-server/
│   │       │   ├── README.md
│   │       │   ├── api.js
│   │       │   ├── ecosystem.config.js
│   │       │   └── package.json
│   │       ├── pm2-plus-metrics-actions/
│   │       │   ├── README.md
│   │       │   ├── custom-metrics.js
│   │       │   ├── ecosystem.config.js
│   │       │   └── package.json
│   │       └── python-app/
│   │           ├── README.md
│   │           ├── echo.py
│   │           ├── ecosystem.config.js
│   │           └── package.json
│   └── tools/
│       ├── Config.js
│       ├── IsAbsolute.js
│       ├── copydirSync.js
│       ├── deleteFolderRecursive.js
│       ├── find-package-json.js
│       ├── fmt.js
│       ├── isbinaryfile.js
│       ├── json5.js
│       ├── open.js
│       ├── passwd.js
│       ├── sexec.js
│       ├── treeify.js
│       ├── which.js
│       └── xdg-open
├── package.json
├── packager/
│   ├── alpine/
│   │   ├── pm2/
│   │   │   └── APKBUILD
│   │   └── pm2_io.rsa.pub
│   ├── build-deb-rpm.sh
│   ├── build-dist.sh
│   ├── debian/
│   │   ├── control
│   │   ├── copyright
│   │   ├── description
│   │   ├── lintian-overrides
│   │   ├── postinst
│   │   ├── postrm
│   │   └── prerm
│   ├── publish_deb_rpm.sh
│   ├── rhel/
│   │   ├── postinst
│   │   ├── postrm
│   │   └── prerm
│   ├── setup.deb.sh
│   └── setup.rpm.sh
├── paths.js
├── pm2
├── preinstall.js
├── pres/
│   └── TMP.md
├── run.sh
├── test/
│   ├── Dockerfile
│   ├── README.md
│   ├── benchmarks/
│   │   ├── monit-daemon.sh
│   │   ├── monit.sh
│   │   └── result.monit
│   ├── docker_parallel_test.sh
│   ├── e2e/
│   │   ├── binaries/
│   │   │   ├── pm2-dev.sh
│   │   │   └── pm2-runtime.sh
│   │   ├── cli/
│   │   │   ├── app-configuration.sh
│   │   │   ├── args.sh
│   │   │   ├── attach.sh
│   │   │   ├── binary.sh
│   │   │   ├── bun.sh
│   │   │   ├── cli-actions-1.sh
│   │   │   ├── cli-actions-2.sh
│   │   │   ├── dump.sh
│   │   │   ├── ecosystem.e2e.sh
│   │   │   ├── env-refresh.sh
│   │   │   ├── extra-lang.sh
│   │   │   ├── fork.sh
│   │   │   ├── mjs.sh
│   │   │   ├── monit.sh
│   │   │   ├── multiparam.sh
│   │   │   ├── operate-regex.sh
│   │   │   ├── piped-config.sh
│   │   │   ├── plus.sh
│   │   │   ├── python-support.sh
│   │   │   ├── reload.sh
│   │   │   ├── reset.sh
│   │   │   ├── resurrect.sh
│   │   │   ├── right-exit-code.sh
│   │   │   ├── serve.sh
│   │   │   ├── smart-start.sh
│   │   │   ├── sort.sh
│   │   │   ├── start-app.sh
│   │   │   ├── startOrX.sh
│   │   │   └── watch.sh
│   │   ├── docker.sh
│   │   ├── esmodule.sh
│   │   ├── file-descriptor.sh
│   │   ├── include.sh
│   │   ├── internals/
│   │   │   ├── daemon-paths-override.sh
│   │   │   ├── increment-var.sh
│   │   │   ├── infinite-loop.sh
│   │   │   ├── listen-timeout.sh
│   │   │   ├── options-via-env.sh
│   │   │   ├── promise.sh
│   │   │   ├── signal.sh
│   │   │   ├── source_map.sh
│   │   │   ├── start-consistency.sh
│   │   │   ├── wait-ready-event.sh
│   │   │   └── wrapped-fork.sh
│   │   ├── logs/
│   │   │   ├── log-create-not-exist-dir.sh
│   │   │   ├── log-custom.sh
│   │   │   ├── log-entire.sh
│   │   │   ├── log-json.sh
│   │   │   ├── log-namespace.sh
│   │   │   ├── log-null.sh
│   │   │   ├── log-reload.sh
│   │   │   └── log-timestamp.sh
│   │   ├── misc/
│   │   │   ├── cron-system.sh
│   │   │   ├── inside-pm2.sh
│   │   │   ├── instance-number.sh
│   │   │   ├── misc.sh
│   │   │   ├── nvm-node-version.sh
│   │   │   ├── port-release.sh
│   │   │   ├── startup.sh
│   │   │   ├── versioning-cmd.sh
│   │   │   └── vizion.sh
│   │   ├── modules/
│   │   │   ├── get-set.sh
│   │   │   ├── module-safeguard.sh
│   │   │   └── module.sh
│   │   ├── process-file/
│   │   │   ├── app-config-update.sh
│   │   │   ├── append-env-to-name.sh
│   │   │   ├── homogen-json-action.sh
│   │   │   ├── js-configuration.sh
│   │   │   ├── json-file.sh
│   │   │   ├── json-reload.sh
│   │   │   └── yaml-configuration.sh
│   │   └── pull.sh
│   ├── e2e.sh
│   ├── fixtures/
│   │   ├── 001-test.js
│   │   ├── all.json
│   │   ├── all2.json
│   │   ├── app-config-update/
│   │   │   ├── args1.json
│   │   │   ├── args2.json
│   │   │   └── echo.js
│   │   ├── append-env-to-name.json
│   │   ├── args/
│   │   │   ├── echo.js
│   │   │   └── params_check.js
│   │   ├── args.js
│   │   ├── bashscript.sh
│   │   ├── big-array-es6.js
│   │   ├── big-array-listen.js
│   │   ├── big-array.js
│   │   ├── binary-js-file
│   │   ├── binary-js-file.js
│   │   ├── binary-py-file.py
│   │   ├── c-compile/
│   │   │   └── hello.c
│   │   ├── change_cwd.json
│   │   ├── child.js
│   │   ├── child_no_http.js
│   │   ├── cluster/
│   │   │   └── sigint_catcher.js
│   │   ├── cluster-alias.json
│   │   ├── cluster-pm2.json
│   │   ├── conf.json
│   │   ├── configuration.js
│   │   ├── configuration.json
│   │   ├── containerizer/
│   │   │   ├── Dockerfile.dev
│   │   │   └── Dockerfile.prod
│   │   ├── cron-stop.js
│   │   ├── cron.js
│   │   ├── cron_no_autorestart.js
│   │   ├── custom_actions/
│   │   │   └── index.js
│   │   ├── delayed_exit.js
│   │   ├── docker/
│   │   │   └── expressor/
│   │   │       ├── Dockerfile.bak
│   │   │       ├── app.js
│   │   │       ├── package.json
│   │   │       ├── process.json
│   │   │       └── worker.js
│   │   ├── echo-env.js
│   │   ├── echo-pm2.json
│   │   ├── echo-post.json
│   │   ├── echo-to-pm2.json
│   │   ├── echo.coffee
│   │   ├── echo.js
│   │   ├── echo2.js
│   │   ├── echo3.js
│   │   ├── echoto-pm2.json
│   │   ├── ecosystem/
│   │   │   └── ecosystem.config.js
│   │   ├── ecosystem.config.js
│   │   ├── ecosystem.json
│   │   ├── ecosystem.json5
│   │   ├── empty.js
│   │   ├── env-ecosystem.json
│   │   ├── env-refreshed.json
│   │   ├── env-switching/
│   │   │   ├── app.json
│   │   │   └── child.js
│   │   ├── env.js
│   │   ├── env.json
│   │   ├── esmodules/
│   │   │   ├── mjs/
│   │   │   │   ├── circle.mjs
│   │   │   │   └── index.mjs
│   │   │   └── packagemodule/
│   │   │       ├── circle.js
│   │   │       ├── index.js
│   │   │       └── package.json
│   │   ├── events/
│   │   │   ├── custom_action.js
│   │   │   ├── custom_action_with_params.js
│   │   │   └── own_event.js
│   │   ├── exitcode42.js
│   │   ├── extra-lang/
│   │   │   ├── app-python.config.js
│   │   │   ├── apps.json
│   │   │   ├── echo.php
│   │   │   └── echo.py
│   │   ├── git/
│   │   │   ├── COMMIT_EDITMSG
│   │   │   ├── HEAD
│   │   │   ├── config
│   │   │   ├── description
│   │   │   ├── hooks/
│   │   │   │   ├── applypatch-msg.sample
│   │   │   │   ├── commit-msg.sample
│   │   │   │   ├── post-update.sample
│   │   │   │   ├── pre-applypatch.sample
│   │   │   │   ├── pre-commit.sample
│   │   │   │   ├── pre-push.sample
│   │   │   │   ├── pre-rebase.sample
│   │   │   │   ├── prepare-commit-msg.sample
│   │   │   │   └── update.sample
│   │   │   ├── index
│   │   │   ├── info/
│   │   │   │   └── exclude
│   │   │   ├── logs/
│   │   │   │   ├── HEAD
│   │   │   │   └── refs/
│   │   │   │       ├── heads/
│   │   │   │       │   └── master
│   │   │   │       └── remotes/
│   │   │   │           └── origin/
│   │   │   │               └── master
│   │   │   ├── objects/
│   │   │   │   ├── 5d/
│   │   │   │   │   └── a45b6659e5cba8f444616f4e18529ad5dde72f
│   │   │   │   ├── 7a/
│   │   │   │   │   └── e6d7c64d39da2167c33993e1f4f0233e8eb6f0
│   │   │   │   └── e6/
│   │   │   │       └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│   │   │   └── refs/
│   │   │       ├── heads/
│   │   │       │   └── master
│   │   │       └── remotes/
│   │   │           └── origin/
│   │   │               └── master
│   │   ├── graceful-exit-no-listen.js
│   │   ├── graceful-exit-send.js
│   │   ├── graceful-exit.js
│   │   ├── homogen-json-action/
│   │   │   ├── all.json
│   │   │   └── http.js
│   │   ├── http.js
│   │   ├── increment-var/
│   │   │   ├── ecosystem.json
│   │   │   └── sample.js
│   │   ├── inside/
│   │   │   ├── echo.js
│   │   │   ├── inner_restart.sh
│   │   │   ├── reload_inside.js
│   │   │   ├── restart_inside.js
│   │   │   └── start_inside.js
│   │   ├── insidePm2Process.js
│   │   ├── interface/
│   │   │   ├── child.js
│   │   │   ├── http_transaction.js
│   │   │   ├── human_event.js
│   │   │   ├── log_out.js
│   │   │   ├── process_exception.js
│   │   │   ├── process_exception_with_logs.js
│   │   │   └── promise_rejection.js
│   │   ├── interpreter/
│   │   │   ├── echo.coffee
│   │   │   ├── echo.ls
│   │   │   ├── echo.ts
│   │   │   └── echo.tsx
│   │   ├── js-configuration/
│   │   │   ├── app.js
│   │   │   └── ecosystem.config.js
│   │   ├── json-reload/
│   │   │   ├── big-array.js
│   │   │   ├── echo-env.js
│   │   │   ├── echo-post.json
│   │   │   ├── echo-pre.json
│   │   │   ├── max-mem-0.json
│   │   │   └── max-mem.json
│   │   ├── killnotsofast.js
│   │   ├── killtoofast.js
│   │   ├── listen-timeout/
│   │   │   └── wait-ready.js
│   │   ├── local_require.js
│   │   ├── log-create-not-exist-dir/
│   │   │   └── echo.js
│   │   ├── log-json/
│   │   │   ├── ecosystem.json
│   │   │   └── one-echo.js
│   │   ├── log-namespace/
│   │   │   └── echo.js
│   │   ├── mjs/
│   │   │   ├── ecosystem.config.js
│   │   │   ├── index.mjs
│   │   │   ├── package.json
│   │   │   └── test.mjs
│   │   ├── module-fixture/
│   │   │   ├── package.json
│   │   │   └── scoped-action.js
│   │   ├── multi-echo.json
│   │   ├── network.js
│   │   ├── no-restart.json
│   │   ├── no-vizion.json
│   │   ├── no_cwd_change.json
│   │   ├── nvm-node-version/
│   │   │   ├── ecosystem-change.json
│   │   │   ├── ecosystem.json
│   │   │   └── http.js
│   │   ├── path-check.js
│   │   ├── path-resolution/
│   │   │   ├── echo.js
│   │   │   ├── ecosystem.config.js
│   │   │   ├── ecosystem2.config.js
│   │   │   └── ecosystem3.config.js
│   │   ├── path1/
│   │   │   ├── iminpath1.js
│   │   │   └── path2/
│   │   │       └── iminpath2.js
│   │   ├── pm2-dev/
│   │   │   ├── app.js
│   │   │   ├── app.json
│   │   │   └── exited_app.js
│   │   ├── pm2-ecosystem.json
│   │   ├── probes.js
│   │   ├── process.json
│   │   ├── promise/
│   │   │   ├── empty-rejection.js
│   │   │   └── rejection.js
│   │   ├── push.json
│   │   ├── python-script.py
│   │   ├── quit.js
│   │   ├── send-data-process/
│   │   │   └── return-data.js
│   │   ├── serve/
│   │   │   ├── 404.html
│   │   │   ├── ecosystem-serve.json
│   │   │   ├── ecosystem.json
│   │   │   ├── index.html
│   │   │   └── other.html
│   │   ├── server.js
│   │   ├── signal-send.js
│   │   ├── signal.js
│   │   ├── signals/
│   │   │   ├── delayed_send.js
│   │   │   └── delayed_sigint.js
│   │   ├── sort/
│   │   │   ├── http.js
│   │   │   └── other.js
│   │   ├── source-map/
│   │   │   ├── main.js
│   │   │   └── models.js
│   │   ├── start-app/
│   │   │   ├── ecosystem-bun.config.js
│   │   │   ├── ecosystem.config.js
│   │   │   └── http.js
│   │   ├── start-consistency/
│   │   │   ├── child.js
│   │   │   └── child.json
│   │   ├── startProcessInsidePm2.js
│   │   ├── startProcessInsidePm2.json
│   │   ├── stdin/
│   │   │   └── stdin.js
│   │   ├── stdout-stderr.js
│   │   ├── stop-exit-codes.json
│   │   ├── throw-later.js
│   │   ├── throw-later.json
│   │   ├── throw-later1.json
│   │   ├── throw-string.js
│   │   ├── throw.js
│   │   ├── toto.js
│   │   ├── wait_ready_event/
│   │   │   ├── http-wait-start.js
│   │   │   └── http-wait-start_nocb.js
│   │   ├── watch/
│   │   │   ├── app-watch-rename.json
│   │   │   ├── app-watch.json
│   │   │   ├── app.json
│   │   │   └── http.js
│   │   ├── watcher/
│   │   │   ├── donotwatchme.dir/
│   │   │   │   └── .gitkeep
│   │   │   ├── server-watch.bak.js
│   │   │   └── server-watch.json
│   │   └── yaml-configuration/
│   │       ├── apps.yaml
│   │       ├── apps.yml
│   │       ├── child.js
│   │       ├── echo.js
│   │       ├── echo.py
│   │       └── malformated.yml
│   ├── helpers/
│   │   ├── apps.js
│   │   └── plan.js
│   ├── interface/
│   │   ├── README.md
│   │   ├── bus.fork.spec.mocha.js
│   │   ├── bus.spec.mocha.js
│   │   ├── mocha.opts
│   │   └── utility.mocha.js
│   ├── parallel.js
│   ├── pm2_check_dependencies.sh
│   ├── programmatic/
│   │   ├── api.backward.compatibility.mocha.js
│   │   ├── api.mocha.js
│   │   ├── auto_restart.mocha.js
│   │   ├── client.mocha.js
│   │   ├── cluster.mocha.js
│   │   ├── common.mocha.js
│   │   ├── conf_update.mocha.js
│   │   ├── configuration.mocha.js
│   │   ├── containerizer.mocha.js
│   │   ├── custom_action.mocha.js
│   │   ├── dump.mocha.js
│   │   ├── env_switching.js
│   │   ├── exp_backoff_restart_delay.mocha.js
│   │   ├── filter_env.mocha.js
│   │   ├── fixtures/
│   │   │   ├── auto-restart/
│   │   │   │   └── throw.js
│   │   │   ├── exp-backoff/
│   │   │   │   ├── throw-stable.js
│   │   │   │   └── throw.js
│   │   │   ├── instances/
│   │   │   │   ├── echo.js
│   │   │   │   └── http.js
│   │   │   ├── json-env-passing/
│   │   │   │   ├── echo.js
│   │   │   │   └── ecosystem.config.js
│   │   │   ├── tar-module/
│   │   │   │   ├── mono-app-module/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── ecosystem.config.js
│   │   │   │   │   ├── http.js
│   │   │   │   │   └── package.json
│   │   │   │   └── multi-app-module/
│   │   │   │       ├── README.md
│   │   │   │       ├── ecosystem.config.js
│   │   │   │       ├── http.js
│   │   │   │       └── package.json
│   │   │   └── version-test/
│   │   │       ├── index.js
│   │   │       └── package.json
│   │   ├── flagExt.mocha.js
│   │   ├── flush.mocha.js
│   │   ├── god.mocha.js
│   │   ├── graceful.mocha.js
│   │   ├── id.mocha.js
│   │   ├── inside.mocha.js
│   │   ├── instances.mocha.js
│   │   ├── internal_config.mocha.js
│   │   ├── issues/
│   │   │   └── json_env_passing_4080.mocha.js
│   │   ├── json_validation.mocha.js
│   │   ├── lazy_api.mocha.js
│   │   ├── logs.js
│   │   ├── max_memory_limit.js
│   │   ├── misc_commands.js
│   │   ├── module_configuration.mocha.js
│   │   ├── module_tar.mocha.js
│   │   ├── modules.mocha.js
│   │   ├── namespace.mocha.js
│   │   ├── path_resolution.mocha.js
│   │   ├── programmatic.js
│   │   ├── reload-locker.mocha.js
│   │   ├── resurect_state.mocha.js
│   │   ├── send_data_process.mocha.js
│   │   ├── signals.js
│   │   ├── sys_infos.mocha.js
│   │   ├── user_management.mocha.js
│   │   ├── version.mocha.js
│   │   └── watcher.js
│   └── unit.sh
└── types/
    ├── index.d.ts
    └── tsconfig.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

# Makefile
[Makefile]
indent_style = tab


================================================
FILE: .gitattributes
================================================
* text=auto
*.sh eol=lf
bin/** eol=lf
test/fixtures/** eol=lf


================================================
FILE: .github/CONTRIBUTING.md
================================================
# Contributing to PM2

## Pull-Requests

1. Fork pm2
2. Create a different branch to do your fixes/improvements if it's core-related.
3. Please add unit tests! There are lots of tests take examples from there!
4. Try to be as clear as possible in your commits
5. Pull request on the **development branch** from your fork

We 'd like to keep our master branch as clean as possible, please avoid PRs on master, thanks!

## Fire an issue

When you got an issue by using pm2, you will fire an issue on [github](https://github.com/Unitech/pm2). We'll be glad to help or to fix it but the more data you give the most fast it would be resolved.
Please try following these rules it will make the task easier for you and for us:

#### 1. Search through issues if it hasn't been resolved yet
#### 2. Make sure that you provide following informations:
  - pm2 version `pm2 --version`
  - nodejs version `node --version`
  - operating system
  - `head -n 50 ~/.pm2/pm2.log` output

#### 3. Provide details about your issue:
  - What are the steps that brought me to the issue?
  - How may I reproduce this? (this isn't easy in some cases)
  - Are you using a cluster module? Are you trying to catch SIGTERM signals? With `code` if possible.

#### 4. Think global
If your issue is too specific we might not be able to help and stackoverflow might be a better place to seak for an answer

#### 5. Be clear and format issues with [markdown](http://daringfireball.net/projects/markdown/)
Note that we might understand english, german and french but english is prefered.

#### 6. Use debugging functions:

```DEBUG=pm2:* PM2_DEBUG=true ./bin/pm2 --no-daemon start my-buggy-thing.js```

If your issue is flagged as `need data` be sure that there won't be any upgrade unless we can have enough data to reproduce.


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
## What's going wrong?

## How could we reproduce this issue?

## Supporting information

```
# Run the following commands
$ pm2 report
```


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
<!--
Please always submit pull requests on the development branch.
-->
| Q             | A
| ------------- | ---
| Bug fix?      | yes/no
| New feature?  | yes/no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #1234, #5678
| License       | MIT
| Doc PR        | https://github.com/pm2-hive/pm2-hive.github.io/pulls
<!--
*Please update this template with something that matches your PR*
-->

================================================
FILE: .github/stale.yml
================================================
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 14
# Issues with these labels will never be considered stale
exemptLabels:
  - Inspecting
  - security
  - "P3: Medium"
  - "T: Bug"
  - "S: Open for PR"
  - "T: Enhancement"
  - "T: Feature"
  - "S: In Progress"
  - "S: Pending Release"

# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
  This issue has been automatically marked as stale because it has not had
  recent activity. It will be closed if no further activity occurs. Thank you
  for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
limitPerRun: 30
only: issues


================================================
FILE: .github/workflows/node.js.yml
================================================
name: Node.js CI

on: [push, pull_request]

jobs:

  node-tests:
    runs-on: ubuntu-latest
    timeout-minutes: 30

    strategy:
      matrix:
        node-version: [16.x, 24.x]

    steps:
    - uses: actions/checkout@v4
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - name: Install Python
      run: sudo apt install python3
    - name: Install PHP CLI
      run: sudo apt install php-cli
    - name: Install Node.js dependencies
      run: npm install
    - name: Run end-to-end tests
      run: npm run test:e2e
    - name: Run unit tests
      run: npm run test:unit

  bun-tests:
    runs-on: ubuntu-latest
    timeout-minutes: 30

    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - name: Remove Node.js installed by setup-node action (if any)
      run: |
        if command -v node &> /dev/null; then
          sudo rm -rf "$(which node)"
        fi
        if command -v npm &> /dev/null; then
          sudo rm -rf "$(which npm)"
        fi

    - name: Setup Bun
      uses: oven-sh/setup-bun@v1
    - name: Install dependencies using Bun
      run: bun install
    - name: Run end-to-end tests with Bun
      run: bun run test:e2e
    - name: Run unit tests with Bun
      run: bun run test:unit


================================================
FILE: .gitignore
================================================
/node_modules
*.log
*.pid
test/child
*.iml
.idea/**
*.heapsnapshot
*.cpuprofile
.cache-require-paths.json
dist/
*.deb
*.rpm
.DS_Store
*.swp
*.swo
currentTagChangelog.md
joblog-X
test/fixtures/path-check*.txt
yarn.lock
*.tar.gz
e2e_time
unit_time
*.heapprofile
a.out


================================================
FILE: .mocharc.js
================================================

module.exports = {
  'allow-uncaught' : false,
  'async-only': false,
  bail: true,
  color: true,
  delay: false,
  diff: true,
  exit: true,
  timeout: 10000,
  'trace-warnings': true,
  ui: 'bdd',
  retries: 2
}


================================================
FILE: .npmignore
================================================
test
apps
doc
/pres
*.log
*.pid
examples
*.pyc
.github
.cache-require-paths.json
*.heapsnapshot
packager
artifacts
.editorconfig
.bithoundrc
dist


================================================
FILE: CHANGELOG.md
================================================

## 6.0.14

- Fixed version of @pm2/pm2-version-check #6055
- CVE-2025-64718 Update js-yaml
- replace fs.R_OK with fs.constants.T_OK #6012 #6019

## 6.0.13

- Fix blessed package import

## 6.0.12

- #6037 Drop npm-shrinkwrap in favor of fixed dependencies versions
- #5577 fix pm2 monit crash

## 6.0.11

- #6034 replace package-lock.json by npm-shrinkwrap.json
- #5915 fix allowing to update namespaced pm2 NPM module (@org/module-name)

## 6.0.10

- revert #5971 #6031

## 6.0.9

- updates all typescript definitions
- upgrade github ci workflows
- upgrade mocha dep and adapt tests
- bump packages
- fix:Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation #5971

## 6.0.8

- fix: package-lock update

## 6.0.7

- fix: ansis-node10 https://github.com/Unitech/pm2/commit/99d9224e940d119a1ad5b241b4fc4e0db7c830ed @webdiscus

## 6.0.6

- refactor: replace chalk with smaller alternative by @webdiscus

## 6.0.5

- Bun support - Fixes #5893 #5774 #5682 #5675 #5777
- Disable git parsing by default #5909 #2182 #5801 #5051 #5696
- Add WEBP content type for pm2 serve #5900 @tbo47
- Enable PM2 module update from tarball #5906 @AYOKINYA
- Fix treekil on FreeBSD #5896 @skeyby
- fix allowing to update namespaced pm2 NPM module (@org/module-name) #5915 @endelendel

## 5.4.3

- Update sub packages

## 5.4.2

- Update sub packages

## 5.4.1

- @pm2/io DeprecationWarning: The util._extend API is deprecated https://github.com/keymetrics/pm2-io-apm/issues/301 @egoroof

## 5.4.0

- #5782 add autostart true||false feature by @ultimate-tester
- fix UUID deprecation
- updates modules

## 5.3.1

- #5686 Switch from Travis CI to Github Actions
- #5680 Fixed reserved keyword for ES6 Strict Mode when Bundling @juaneth
- #5683 update badges
- #5684 auto switch light and dark mode logos
- #5678 Bugfix/deploy ecosystem filename extension / esm module default ecosystem config name @TeleMediaCC
- #5660 Fix matching logic for logs from namespace when lines = 0 @bawjensen
- fix "vulnerabilities" in axios module

## 5.3.0

- fix: replace non-working condition that blocks flush from clearing the logs #5533 @Sailboat265
- fix: ESM script loader #5524 @BlueWater86

## 5.2.2

- fix: correct pm2 ls display when there is a (very) long process id (@dko-slapdash)
- typo: corrections

## 5.2.1

- fix cluster error avoiding process restart (#5396)
- ensure increment_var value is a number (#5435)
- update dependencies
- add node latest to travis testing

## 5.2.0

- replace node-cron by croner (#5183 #5035)
- upgrade mocha deps
- fix pm2 report when daemon not running
- remove semver check for legacy node.js versions
- update node version in setup.deb.sh by using lts (#5201) + openrc
- replace legacy util._extend by Object.assign (#5239)
- add missing start options types (#5242)
- recursive detection of package.json (#5267)
- make tarball module uninstall cross-platform (#5269)
- Fix unnecessary "ENOENT" console.error when serving a spa (#5272)
- fix: used env variable instead of hardcode datetime format (#5277)
- copyright update (#5278)
- fix: remove constants import from VersionCheck (not needed) (#5279)
- Reduce async import (#5280)

## 5.1.2

- easily disable cron-restart strategy via `$ pm2 restart --cron-restart 0`
- allow to update cron-restart on restart

## 5.1.1

- remove fast-printf and replace with sprintfjs

## 5.1.0

- add back Node 10.x support
- make pm2-sysmonit module optional

## 5.0.3

- skip system monitoring on Windows

## 5.0.1/5.0.2

- fix npm install --no-optional pm2

## 5.0.0

### System Monitoring

A new local system monitoring feature has been added, allowing to monitor numerous vital server metrics.

Most important metrics will be displayed when doing a pm2 ls:

```bash
┌─────┬─────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name            │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼─────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 4   │ app             │ default     │ 1.0.0   │ fork    │ 164618   │ 2s     │ 1670 │ online    │ 0%       │ 41.8mb   │ unitech  │ disabled │
└─────┴─────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
host metrics | cpu: 1.6% 42.9º | mem free: 52.0% | wlp0s20f3: ⇓ 0mb/s ⇑ 0mb/s | disk: ⇓ 0.199mb/s ⇑ 0mb/s /dev/nvme0n1p3 88.25% |
```

All server metrics will be available to pm2.io:

```
┌─────────────────────────────┬──────────────────────────────────┐
│ PM2 CPU Usage               │ 0.0 %                            │
│ PM2 Memory Usage            │ 67.4 mb                          │
│ PM2 Agent CPU Usage         │ 0 %                              │
│ PM2 Agent Memory Usage      │ 0 mb                             │
│ CPU Usage                   │ 1.5 %                            │
│ CPUs Usage                  │ 0|0|0|0|2|0|0|1|0|0|0|1|0|1|2|8  │
│ CPU Temperature             │ 42.9 °C                          │
│ RAM Total                   │ 15.34 gb                         │
│ RAM Free                    │ 1.18 gb                          │
│ RAM Active                  │ 7.35 gb                          │
│ RAM Available               │ 7.99 gb                          │
│ RAM Usage                   │ 47.9 %                           │
│ FD Opened                   │ 15072                            │
│ Disk Writes                 │ 0 mb/s                           │
│ Disk Reads                  │ 0.24 mb/s                        │
│ Disk Usage                  │ 88.25 %                          │
│ Disk Size                   │ 465.60 gb                        │
│ Total TX                    │ 0.005 mb/s                       │
│ Total RX                    │ 0.004 mb/s                       │
│ fs:use:/dev/nvme0n1p3       │ 88.25 %                          │
│ fs:size:/dev/nvme0n1p3      │ 465.60 gb                        │
│ net:tx_5:wlp0s20f3          │ 0.005 mb/s                       │
│ net:rx_5:wlp0s20f3          │ 0.004 mb/s                       │
│ net:rx_errors_60:wlp0s20f3  │ 0 /min                           │
│ net:tx_errors_60:wlp0s20f3  │ 0 /min                           │
│ net:rx_dropped_60:wlp0s20f3 │ 0 /min                           │
│ net:tx_dropped_60:wlp0s20f3 │ 0 /min                           │
│ graphics:mem:total          │ 3878 mb                          │
│ graphics:mem:used           │ 1260 mb                          │
│ graphics:temp               │ 46 °C                            │
└─────────────────────────────┴──────────────────────────────────┘
```

#### Disabling system monitoring

```
# Disable system monitoring
pm2 set pm2:sysmonit false
# Enable system monitoring
pm2 set pm2:sysmonit true
```

### PM2.io bandwidth reduction

Data quantity sent from PM2 to PM2.io has been reduced by 80%, thanks for a json patch differential system. Much more data can now be exposed (metrics, actions) to PM2.io

### Other fixes

- feat: added args and full script path to monitoring data
- fix: regular local ip check
- fix: pm2 agent watchdog has been consolidated and fixes freezing issues
- fix: modules bumped

## 4.5.6

- all submodules version bumped
- supress all "security" warnings

## 4.5.5

- bump debug
- remove systeminformation

## 4.5.4

- drop non used package

## 4.5.3

- bump vizion from 0.2.13 to 2.2.1 (Snyk CVE)
- bump chokidar to 3.5.1

## 4.5.2

- bump @pm2/js-api

## 4.5.1

- fix: cron in cluster mode was not restarting process after one pass - fixes #4834 #4733 #4307 #4834
- fix: restore --sort <param> option on `pm2 ls` - fix #4536
- fix: fix tests with npm7
- fix: restore warning message about process list changed and not dumped
- chore: alias `--cron` with `--cron-restart`
- chore: test PM2 againt Node.js 15.x
- chore: upgrade systeminformation and debug module to latest - PR #4892 by @AdamMajer
- chore: drop Node 9.x from travis testing
- chore: remove ps-list module

## 4.5.0

- fix: creating log folder in sync mode. #4846 - PR #4844 by @QS20199
- fix: PM2 unable to run ESM packages: ERR_UNSUPPORTED_ESM_URL_SCHEME #4839 - PR #4841 by @ox-harris
- fix: Use opts.namespace if it was passed in. Previously, it was ignored. #4778 - PR #4791 by @sbleon
- fix: Prevent reloadLogs command from hanging. #4781 - PR #4782 by @mbrooks and Franck Danard
- fix: backward compatibility fix for tarball modules - PR #4767 by @ykolbin
- fix: Operation not permitted on call setgid #2957 - PR #4681 by @guard43ru
- chore: upgrade dependencies

## 4.4.1

- feature drop: autodump fixes #4763
- fix: fix starting pm2 script from inside an app #4761 (need use PM2_PROGRAMMATIC)

## 4.4.0

- feature: support Node v14.0

## 4.3.1

- fix: downgrade vizion

## 4.3.0

- feature: reduce by 1/3 pm2 package size (drop moment, lodash)
- feature: pm2 start app.js --filter-env NODE_ENV #4596
- feature: print logs of a particular namespace #4517 @bvsubhash
- feature: trigger all the process using 'all' or trigger all processes in a particular namespace #4518 @bvsubhash
- feature: support ecosystem.config.cjs #4662 @Timic3
- fix: disable log (--error /dev/null --output /dev/null) on Windows #4560 @codpot
- fix: pm2 install <tar_file> adaptation #4593 @adunkey
- fix: add type for pm2.reload with optional options parameter #4615 @kevindoveton
- fix: add `ignore_watch` to StartOptions types #4629 @jlvcm
- fix: fix --cwd CLI option description #4639 @warpdesign
- fix: do not require cron if not necessary in CLI
- fix: upgrade mkdirp to 1.0.4 (sec vuln) #4638
- chore: bump mocha to latest + drop mocha.opts + add .mocharc.yml
- chore: pm2 init ecosyst file template changes
- chore: pm2-deploy@1.0.2 (revert fix)
- chore: pm2-io-apm@4.3.4 (instant trace + broadcast trace threshold + boolean metrics support)


## 4.2.3

- fix: Fix an import error on Node 9.x

## 4.2.2

- feat: Support ESM on Node 13 via .mjs file or `"type":"module"` in package.json #4540
- fix: Fix an error for pm2 path on Windows. #4563

## 4.2.1

- fix: col size too small for certain app name with tracing enabled
- chore: check for pm2 updates

## 4.2.0

- feature: `pm2 logs --highlight <str>` to highlight specified string when using `pm2 logs` #4013 by @bvsubhash
- feature: `pm2 sysmonit` activate system wide monitoring && `pm2 sysinfos` display system informations
- feature: new App Namespace feature via `namespace` attr or `pm2 start app.js --namespace <ns>` #3471 by @bvsubhash
- feature: enforce message sending for Windows Graceful Shutdown via `pm2 start app.js --shutdown-with-message` to use message sending for specific process or via `PM2_KILL_USE_MESSAGE=true pm2 update` to default this behavior on PM2. #3561 #3691 #3555 #4469 #4470 #4474 by @aleksk and @8ai
- feature: `pm2 ls` now display a hint when process list differ from dump file
- fix: if id > 100 not shown in pm2 ls #4475
- fix: stop and delete cron immediately on deletion of a process #4492 by @bvsubhash
- fix: display correct username by @bvsubhash
- chore: add test on node 13.x
- chore: cleanup some unused files
- chore: enforce node >= 8.10.0

## 4.1.2

- fix: temporarily disable system metrics retrieval

## 4.1.1

- fix: #4452 disable network collection metric

## 4.1.0

- fix: #4270 fix ANSI escape for `pm2 ls --watch`
- fix: `pm2 start app.js -i 1` start app in cluster mode
- fix: #4254 add HOST environment variable on pm2 serve
- fix: #4267 Allow usernames in uid/gid/user again
- fix: #4376 make process.send('ready') trigger sigint
- fix: #4443 allow pm2-runtime to auto-exit even if modules are still running
- fix: #4364 typos
- fix: #4288 add 'max' type in typescript definition

## 4.0.2

- fix: #4450 do not open sysinfo window on Windows

## 4.0.1

- chore: switch Systeminfo logging to debug

## 4.0.0

- feat: make pm2 fully standalone with node embedded
- feat: startup, npm, node system adaptation for standalone installs
- feat: system information worker - retrieve:
           - network I/O + latency
           - disk I/O + space
           - cpu usage + temperature
           - memory usage
           - intelligent display of information (e.g. display disks > 80% cpu usage)
- feat: listing of docker container on host machine with independent pm2 list
- feat: upgrade of Chokidar to 3.x - Massive CPU & RAM consumption improvements for watch feature
- r&d: manage container like pm2 processes
- feat: intelligent display of high loaded processes in an independent pm2 list
- feat: #4224 --ignore-watch now accepts globs (@vaskevich)
- feat: pm2 save --force allow to force save of empty process list
- fix: pm2 monit dashboard without leaks
- fix: pm2 register fixed
- refactor/fix: pm2 listing systems refactoring
- chore: remove old legacy code for < 8 Node.js versions
- chore: make the repo lighter
- chore: better display when pm2-runtime is linked to on-premise
- chore: pm2 CLI refactoring #4391

## 3.5.0

- feat: #4220 #2941 #4196 improve pm2 serve for SPA - autoredirect requests to index.html if --spa
- feat: on pm2 show <app>, display metric unit and divergent environment variables
- feat: #4157 tweak systemd script to auto restart PM2 in case of crash failure
- fix: #4212 on pm2 show, avoid crash when versioning comment is not present
- fix: #4171 fix pm2 list when small screen
- fix: #4197 fix pm2 unstartup for macOS
- fix: #2764 in pm2 monit, only display log of selected application
- fix: #2793 pm2 monit, rolling log buffer, avoid crash and performance issues
- fix: #4060 do not emit online when application is errored
- chore: remove nssocket in dependencies

## 3.4.1

- fix: allow pm2 register / pm2 monitor
- fix: restore trace indicator

## 3.4.0

- use @pm2/io version 4
- disable @pm2/io for node.js v4 and v5

/!\ Warning, built-in custom metrics are not supported anymore on Node 4 and 5

New builtin metrics when starting a Node.js application:
- Heap Size
- Heap Usage
- Used Heap Size
- Active Requests
- Active handles
- Event loop latency
- Event loop latency p95
- HTTP queries per minutes
- HTTP Mean Latency
- HTTP P95 Latency

## 3.3.1 (18/02/19)

- add pm2 profile:cpu [timeout]
- add pm2 profile:mem [timeout]

## 3.3.0 (14/02/19)

- Upgrade pmx to ^3

## 3.2.9 (17/01/19)

- #4128 fix: force detached process

## 3.2.6-8 (11/01/19)

- rollback: node bin path handling adaptation

## 3.2.5 (09/01/19)

- feat: enhance pm2 report
- feat: support snap Ubuntu system
- fix: pm2 register/monitor command
- fix: consolidate spawn function on unhealthy systems to avoid pm2 crash
- fix: error message if extra lang interpreter are not installed when runing tests
- fix: (pm2 deploy) command line bug when passing env variables to post-deploy hook
- fix: (pm2 deploy) always deploy to default branch problem
- fix: (pm2 deploy) pm2 deploy <env> exec now accept multiple commands
- fix: print full env + skip extra internal fields when using programmatic pm2

## 3.2.4 (19/12/18)

### Feat

- display cron configuration when doing `pm2 desc <id>`
- refactor test suite (benchmark/simplification)

### Fix

- pm2 flush <app> flush only one app
- resolve uid properly on pm2 ls / pm2 desc
- keep wait_ready option on process reload
- keep stringification of environment variable behavior
- return an error when using pm2 api on starting json configuration if one app is errored

## 3.2.3 (4/12/18)

### Fix

- medium rare bug: fix issue when acting on process file (#3987 + #3192)
- concurrent action to 1 if acting on only 2 processes
- fix cluster syntax
- add more test on port release

## 3.2.2 (5/10/18)

### Fix

- minor bug: fix bug when passing -i 'max' or -i 0

## 3.2.1 (3/10/18)

### Fix

- minor bug: get internal pm2 config after creation on new pm2 boots

## 3.2.0 (3/10/18)

### Features

- package.json version field retrieval and display in pm2 ls, pm2 show, pm2 monit
- pm2 internal configuration system via `pm2 set pm2:key value`, attached to pm2.user_conf
- add the .user field (CLI + Config) to set the user to start the application with
- add the .time field (CLI + Config) to enable default logs date prefix
- max_memory_restart now triggers a reload
- pm2 env <pm_id> command to display the environment the application is running with
- exponential backoff restart delay via `--exp-backoff-restart-delay <ms>` with reset mechanism
- new timing library on PM2 daemon (increase log througput, reduce CPU usage and memory usage)
- better user management system with username resolution to uid
- websocket default switch for pm2 plus
- new module management system (`pm2 package <folder>`, `pm2 publish <folder>`, `pm2 install <tarball>`)

### Fix

- @pm2/io 2.4 (restart > 10.0)
- restart behavior tested
- fix module version parsing
- module system refactoring (TAR + NPM)
- fix watch_delay in config file

## 3.1.3 (20/09/18)

### Features
- allow non-node application to run multiple instances without auto switch to cluster mode
- allow to call `pm2 logs` even without application (#3820)
- switch `pm2 link` and `pm2 plus` protocol to websocket by default instead of axon
- enhance the `pm2 init` template that generates ecosystem files by adding some extra fields

### Fix
- remove deprecation message for node 0.10
- pm2 login/register/monitor now hit the new oauth pm2 plus system

## 3.1.2 (10/09/18)

- version bump on @pm2/io

## 3.1.1 ( Mon Sep 10 2018 16:18:25 GMT+0200 (CEST) )


## Hot Fixes
  - #3901 fix error when installing module
  ([7b43fea5](https://github.com/Unitech/pm2/commit/7b43fea55d7c2853a3032b3bddd12201cd6a29e9))


## 3.1.0 ( Mon Sep 10 2018 10:25:13 GMT+0200 (CEST) )


## Bug Fixes
  - tmp fix io@beta + rename metric
  ([04ab7ac4](https://github.com/Unitech/pm2/commit/04ab7ac4e1312c5a5332f37cbb81b0d98686936d))
  - remove ending \n on git version comment
  ([9a36bfeb](https://github.com/Unitech/pm2/commit/9a36bfeb7e9f5ab1719ca3858510da08bb0cad6b))
  - #3883 fix typings for max_memory_restart and add wait_ready
  ([b35ea237](https://github.com/Unitech/pm2/commit/b35ea237e3b448088112b2f3a771a9c5286417a7))
  - restore monitored indicator
  ([34966432](https://github.com/Unitech/pm2/commit/349664329eb56232321694be9e08f16a3cda6fbd))
  - remove install of modules on pm2 plus command
  ([6a8bb269](https://github.com/Unitech/pm2/commit/6a8bb26952a7dcf109d28af7224b89faf0977a71))
  - invert kill/link
  ([3c37b528](https://github.com/Unitech/pm2/commit/3c37b5283bf0dea130fd375a5563974bd84543a9))
  - #3877 #3831
  ([16f4f2bc](https://github.com/Unitech/pm2/commit/16f4f2bc6589e8f0666f46d37c3f7f7739de7261))
  - #3865 ensure pm2 never run simultaneous gracefullExit, prevent dump file corruption
  ([79679db1](https://github.com/Unitech/pm2/commit/79679db1b321bbcc7296dbc41d005500cf61d273))
  - #3786 fix issue when triggering an action that does not exist
  ([1ff7fd3d](https://github.com/Unitech/pm2/commit/1ff7fd3d49ccaf3f65540774426b62fdc811e4f1))
  - fixed unstartup when launchd
  ([3d0461c3](https://github.com/Unitech/pm2/commit/3d0461c3e0a2362aef009e6f158b6f16b3d6510c))
  - access gl_retry as class property
  ([bbcb2b6b](https://github.com/Unitech/pm2/commit/bbcb2b6b5c5fa0ef872b64a648461c266350423a))
  - #3831 switch registerToKM() to register()
  ([8df2451e](https://github.com/Unitech/pm2/commit/8df2451e05bf5494b11f0546965718efe1f351b9))




## Features
  - add id column in stacked mode (80 char mode)
  ([83033d4c](https://github.com/Unitech/pm2/commit/83033d4cdeb899bc4c1d1fe7a8c6391e64e9d0d0))




## Refactor
  - only enable deep monitoring if explicitly stated
  ([f67e14f0](https://github.com/Unitech/pm2/commit/f67e14f0bd6d65bff6ef8f7e27e3f0aa93c60e40))
  - #3786 clean code
  ([6cbca8bc](https://github.com/Unitech/pm2/commit/6cbca8bccc0126f1557bf8326c81facc62100704))
  - removes unused imports.
  ([b8b48e83](https://github.com/Unitech/pm2/commit/b8b48e83f7f041508e39815e22501509259d4f26))
  - only import the necessary methods from async.
  ([6466ee44](https://github.com/Unitech/pm2/commit/6466ee44c1b85858f9b7e56b01aa6f2a08bde508))
  - removes unused async imports.
  ([679b14ff](https://github.com/Unitech/pm2/commit/679b14ff4b24519b5479c9e5f4ce0d9c32e39e55))




## Chore
  - upgrade to 3.1.0
  ([0285d12d](https://github.com/Unitech/pm2/commit/0285d12df335667e9e0311a7abe175796bb517f4))
  - update apm version
  ([cc27de4a](https://github.com/Unitech/pm2/commit/cc27de4a8b400f1c20ba2e4b12dadcef1dd34fae))
  - README update
  ([c505dcc1](https://github.com/Unitech/pm2/commit/c505dcc1685380728b23f8757aa80fa4387d7fd3))
  - remove unused console.log
  ([61e32a43](https://github.com/Unitech/pm2/commit/61e32a4305490cc64c0a40cd83e2ad48c133b272))
  - upgrade vizion to 2.0.2
  ([c231e286](https://github.com/Unitech/pm2/commit/c231e28604aa4628d8f8ba10ea1f9f82e73269e6))
  - #3415 try to update vizion to 2.0.1
  ([9b80d8c1](https://github.com/Unitech/pm2/commit/9b80d8c1b69c07d21e63441c266b7acafffe0673))
  - #3415 try to update vizion to 2.0.0
  ([2c3df093](https://github.com/Unitech/pm2/commit/2c3df09378a92bac9de2d3b3b83103e02bd1bb82))
  - update readme with 3.0.3 commits
  ([476542fb](https://github.com/Unitech/pm2/commit/476542fbad038b951b6cfe6d6903d7b6bc8540a5))




## Branchs merged
  - Merge branch 'master' into development
  ([95321c6d](https://github.com/Unitech/pm2/commit/95321c6dd2602e9ef71028731fd7a2e7b40a0d3c))
  - Merge branch 'master' into development
  ([c3c0e423](https://github.com/Unitech/pm2/commit/c3c0e423f9beeab25f53c0267d5f8a9e79d5c2e3))
  - Merge branch 'master' into development
  ([8e6481bc](https://github.com/Unitech/pm2/commit/8e6481bc9a6d23283895bf9cd3c7831c49a811ae))
  - Merge branch 'development' into development
  ([83294afe](https://github.com/Unitech/pm2/commit/83294afee7cf0204208e9cc7f4cf687469556492))
  - Merge branch 'development' into flag--ext
  ([79ab9242](https://github.com/Unitech/pm2/commit/79ab92425fef22cdf679fa77840d86a6e7cfc755))
  - Merge branch 'development' into post_install
  ([d5604300](https://github.com/Unitech/pm2/commit/d5604300685ace1c7dbd18776fd3df79da96f638))




## Pull requests merged
  - Merge pull request #3885 from Unitech/typings
  ([19a35e9b](https://github.com/Unitech/pm2/commit/19a35e9b23716df8f7d1301acf7b0f0b601f93dd))
  - Merge pull request #3878 from cuspymd/fix-command-help
  ([2d3d2044](https://github.com/Unitech/pm2/commit/2d3d204427ce02617aa134ca0831a844de1a697d))
  - Merge pull request #3876 from Unitech/lost_apps_sigterm
  ([4fa247a3](https://github.com/Unitech/pm2/commit/4fa247a3e370607cf4198743de41dfa0a94bfbb5))
  - Merge pull request #3874 from Unitech/trigger_no_action
  ([e868f003](https://github.com/Unitech/pm2/commit/e868f003e3063a57236cb8d0ead33af808e0df70))
  - Merge pull request #3872 from Unitech/column_id_stacked
  ([55b6ccc3](https://github.com/Unitech/pm2/commit/55b6ccc32ae02e574ec1f80a36b4531761b94777))
  - Merge pull request #3723 from livankrekh/development
  ([98f49dc3](https://github.com/Unitech/pm2/commit/98f49dc393efd1fed03a1ef8a5752c0e490dd4b8))
  - Merge pull request #3821 from imarakho/post_install
  ([4217b150](https://github.com/Unitech/pm2/commit/4217b1505419904252d0ae7640a51128a2459d98))
  - Merge pull request #3823 from imarakho/flag--ext
  ([cc68dc1f](https://github.com/Unitech/pm2/commit/cc68dc1f9faf010af0648992193230af609413c5))
  - Merge pull request #3822 from imarakho/flush_parameter
  ([bbcc85a4](https://github.com/Unitech/pm2/commit/bbcc85a41683f5fa573bf504894f8e817c89784a))
  - Merge pull request #3807 from medanat/minimize-async-lib-footprint
  ([7e92855f](https://github.com/Unitech/pm2/commit/7e92855ff5c394b5452db526d21262e343b89ef8))
  - Merge pull request #3829 from soyuka/patch-pidusage
  ([a668f576](https://github.com/Unitech/pm2/commit/a668f5762190061dd05de5c5d888b53f35fa386e))







## 3.0.3 ( Tue Aug 07 2018 23:35:05 GMT+0200 (CEST) )


## Bug Fixes
  - pm2 plus + register
  ([277ec6ba](https://github.com/Unitech/pm2/commit/277ec6ba8d1cdda7f8fdf11eb9d9d33c2c095d65))




## 3.0.2 ( Tue Aug 07 2018 23:35:05 GMT+0200 (CEST) )


## Bug Fixes
  - allow tracing activation
  ([f297ef1e](https://github.com/Unitech/pm2/commit/f297ef1ebbec292aedcfa48c27e3f31b8f206633))




## Branchs merged
  - Merge branch 'development'
  ([80c94dd3](https://github.com/Unitech/pm2/commit/80c94dd3261544f627612ce4b541356e4adbc51f))




## 3.0.1 ( Mon Jul 23 2018 14:13:35 GMT+0200 (CEST) )

## Bug Fixes
  - allow to set a name via pm2 link
  ([ebffb609](https://github.com/Unitech/pm2/commit/ebffb609cf4da195c72ee67d8341c63b78f0654e))
  - disable network monitoring as long as ampq not supported
  ([ae1547bf](https://github.com/Unitech/pm2/commit/ae1547bfa9505b2d13e30df39ce614eee29463b0))
  - display error message from pm2-deploy
  ([9171b810](https://github.com/Unitech/pm2/commit/9171b81024641c3e104f3eeb2e2c6eb852dbe7f4))
  - protect geteuid/getegid from being called on windows #3793
  ([0495bd8e](https://github.com/Unitech/pm2/commit/0495bd8e4ffaeb1db729b35fa569696145d79c5f))
  - put message module at the right level
  ([56f5e047](https://github.com/Unitech/pm2/commit/56f5e04787da29e8b582bf4fa8325f72404a2fbe))
  - do not ignore child pres folder
  ([10ee9987](https://github.com/Unitech/pm2/commit/10ee99876d75679723e1e8522da07413a618e48c))
  - let->var
  ([89e2a125](https://github.com/Unitech/pm2/commit/89e2a125c22aee27014c279c86d1d9e0a0df0235))
  - method renaming
  ([f3faa3d8](https://github.com/Unitech/pm2/commit/f3faa3d846d1e895232743dd619f5ecb15fdf7ad))
  - path
  ([4f980550](https://github.com/Unitech/pm2/commit/4f9805508d2c1c575aabc4abbab25728f1c6a28a))
  - #3791 mitigate pidusage errores
  ([88551b8c](https://github.com/Unitech/pm2/commit/88551b8cfe8bf8dd330d582e71b808faadfaf161))
  - pm2 plus
  ([9bc34e56](https://github.com/Unitech/pm2/commit/9bc34e56b7ad66cbc6efbd26d4017f1e1813a720))
  - #3764
  ([3a582b42](https://github.com/Unitech/pm2/commit/3a582b42f9cca57779b99964c95a2cd0516efa11))
  - drop coffee-script (installed via pm2 install coffeescript)
  ([76ceb2fd](https://github.com/Unitech/pm2/commit/76ceb2fd52a2e5acbf03deacc3fa8a120a197023))
  - restore no_interaction for pm2-dev
  ([902e5a5a](https://github.com/Unitech/pm2/commit/902e5a5a1225d2072ab6337aa067caf9c6a7cca4))
  - option -w doesn't work
  ([165a05c8](https://github.com/Unitech/pm2/commit/165a05c854f9b3dd1418b988c954d333f81ba88f))
  - retab shell script to use space for indent consistency
  ([e3b4327d](https://github.com/Unitech/pm2/commit/e3b4327d9a6120c5ad589734ca926d3b49a8b706))
  - set Makefile indent to tab instead of common space
  ([4db0ae01](https://github.com/Unitech/pm2/commit/4db0ae011c161cbfca9e250da40deff9fdc36069))
  - set yaml file indent to 2 spaces instead of 3
  ([e4ecb0b2](https://github.com/Unitech/pm2/commit/e4ecb0b29dbcc4c6ca2d67b6bdc7da4c0a5d17a5))
  - remove trailing spaces
  ([5c115983](https://github.com/Unitech/pm2/commit/5c1159832680231bff5da79f1c91caf32ce3b5e0))
  - fixes #3735
  ([0548cb82](https://github.com/Unitech/pm2/commit/0548cb82aa1193a5725ca22e1babfc38db2e3b77))




## Hot Fixes
  - fix #3767, do not consider as a command if space and slash are found
  ([d15a12ce](https://github.com/Unitech/pm2/commit/d15a12ceae8b0c9c27625180ae002178b0bfe5d0))
  - fix #3767, do not consider as a command if space and slash are found
  ([f8ec1503](https://github.com/Unitech/pm2/commit/f8ec1503c3e92bc0dec10d395ac682b116e2914e))




## Features
  - add inspector for node 10 and heap snapshot
  ([dc61bca6](https://github.com/Unitech/pm2/commit/dc61bca66828c16cf6fd04a6f749f127da697cec))
  - pm2 plus xx yy now generates a name with hostname-UID
  ([fcf75e2c](https://github.com/Unitech/pm2/commit/fcf75e2cc321791273f6afe86c07fd147c6e8414))
  - #3757 --only='app1,app2'
  ([bea98330](https://github.com/Unitech/pm2/commit/bea983306c4736d3a2b1090f2708b7b29c44ed03))
  - pm2 plus cli
  ([1da6edde](https://github.com/Unitech/pm2/commit/1da6edde80e3029d99084992ec1a4ada7b2cc279))
  - reload all apps after connection to pm2 plus
  ([35a1ed2a](https://github.com/Unitech/pm2/commit/35a1ed2a1328a859a7797ec8e22024d171599d86))
  - ask to install module after connection with KM
  ([68e87b39](https://github.com/Unitech/pm2/commit/68e87b39ae2b57e9fbb0b0abde68112c839f05ee))
  - with pm2 plus command ask to install modules
  ([28c61716](https://github.com/Unitech/pm2/commit/28c61716ee5e8f2402205e4b06ed7ee0a942a3cc))




## Test
  - test with development packages
  ([d361c840](https://github.com/Unitech/pm2/commit/d361c8405db47969bd68c7b1058a54f38e8e0e52))




## Chore
  - clean old snapshot method
  ([d064750b](https://github.com/Unitech/pm2/commit/d064750be0d437945efdcd6a5ce4e56547b1bce6))
  - update version to 3.0.1
  ([efbcb021](https://github.com/Unitech/pm2/commit/efbcb02180ae38dd930e43282113dbcb24288eab))
  - bump to 3.0.1
  ([fb8357e3](https://github.com/Unitech/pm2/commit/fb8357e32f9f015e5b6e7ed8ef150f59de382c6d))
  - new ascii logo + refactor pm2 plus command
  ([8692a1da](https://github.com/Unitech/pm2/commit/8692a1daf7b4b7dfb8a4d6ec3363ac0cc62203a8))
  - change motd.update + alias register to pm2 plus
  ([cdc4a767](https://github.com/Unitech/pm2/commit/cdc4a767d5f1ff5873d0466b471daa3006608604))
  - btn
  ([319fa0dc](https://github.com/Unitech/pm2/commit/319fa0dcbea331a88a9888c207368e52665309ce))
  - README button
  ([1c6fb68c](https://github.com/Unitech/pm2/commit/1c6fb68c758d76cf81e53c43c2423ecd742265e5))
  - remove duplicate configs in .editorconfig
  ([86ad52b8](https://github.com/Unitech/pm2/commit/86ad52b837e23a7ec92705d21a152394c244571f))




## Branchs merged
  - Merge branch 'development' into uid-gen
  ([5324c878](https://github.com/Unitech/pm2/commit/5324c878fd0d37e068bc25c8e37f19f73bfebf30))
  - Merge branch 'master' into development
  ([7d04f638](https://github.com/Unitech/pm2/commit/7d04f63835845e92d32d6ad7ffab166a2954302f))




## Pull requests merged
  - Merge pull request #3811 from Unitech/memory_inspector
  ([62018044](https://github.com/Unitech/pm2/commit/62018044d7a1ef7fd0b37fe3082da4bf05989de0))
  - Merge pull request #3801 from vkotovv/grammar-fixes
  ([9bb37a66](https://github.com/Unitech/pm2/commit/9bb37a662a91369caaa5a1a43751541e41970a51))
  - Merge pull request #3799 from Unitech/refactor-agent
  ([bcc4fea8](https://github.com/Unitech/pm2/commit/bcc4fea80885ce941e11b17936aab6582660fc7f))
  - Merge pull request #3787 from Unitech/multi-only
  ([ea5d74a8](https://github.com/Unitech/pm2/commit/ea5d74a87f6911b238634419665c716bc877be10))
  - Merge pull request #3788 from Unitech/uid-gen
  ([f70444f3](https://github.com/Unitech/pm2/commit/f70444f39b7cc8fe05faf57dac1b46fc15a2053c))
  - Merge pull request #3784 from Unitech/pm2-plus-cli
  ([e8c13c37](https://github.com/Unitech/pm2/commit/e8c13c374dfeabf42f75af50b838adb7ac4a50aa))
  - Merge pull request #3780 from Unitech/plus_modules
  ([466d2701](https://github.com/Unitech/pm2/commit/466d2701ca48d0c4b8466d6867135e43b22deeb5))
  - Merge pull request #3768 from Unitech/spaces
  ([0477354b](https://github.com/Unitech/pm2/commit/0477354b502aef612012e833bd47ce1940da1a0b))
  - Merge pull request #3771 from chinesedfan/patch-2
  ([8de987a6](https://github.com/Unitech/pm2/commit/8de987a604679774ec39e7d5a1a905556524c53d))
  - Merge pull request #3762 from shaharmor/issue-3441
  ([429e455d](https://github.com/Unitech/pm2/commit/429e455db96d2a56448a11b7602333324c9bf433))
  - Merge pull request #3761 from PeterDaveHello/fix-sh-indent-style
  ([24cddc25](https://github.com/Unitech/pm2/commit/24cddc257734beebb33ee5abac5a4107a5d86093))
  - Merge pull request #3737 from morugu/add-node-env-output
  ([6628f163](https://github.com/Unitech/pm2/commit/6628f1637497771bbc5c4f0ba0e9423c63660e0e))
  - Merge pull request #3743 from vivex/master
  ([06872c25](https://github.com/Unitech/pm2/commit/06872c2520f73bcabb6198a96c4dafb46706c9e9))
  - Merge pull request #3748 from JimiC/support_nvm4win
  ([2dac235b](https://github.com/Unitech/pm2/commit/2dac235bc8956d170fee2341517739d3781048d7))
  - Merge pull request #3752 from PeterDaveHello/upstart.tpl
  ([d4e66e3a](https://github.com/Unitech/pm2/commit/d4e66e3a9d954ab5c15d5bc35910cdfb71ba8321))
  - Merge pull request #3753 from PeterDaveHello/fix-editorconfig
  ([d1478680](https://github.com/Unitech/pm2/commit/d1478680325822c206afbcb197a9a732318f6d64))
  - Merge pull request #3754 from PeterDaveHello/remove-trailing-space
  ([b660f03e](https://github.com/Unitech/pm2/commit/b660f03eba71bb80a1a3d313be4525160727921f))






## 3.0.0 ( Wed Jun 20 2018 11:06:21 GMT+0200 (CEST) )


## Breaking changes
  - merge_logs is now activated by default if not in cluster mode. Logs will not be suffixed by the pm_id if only one app is started
  ([ae02adf6](https://github.com/Unitech/pm2/commit/ae02adf63f70ceb3bf101be968996ca68d9ce277))
  - Drop support for node 0.12
  - Drop gracefulReload command
  - Remove Interactor from PM2 source code
  - Replace pmx with [pm2-io-apm](https://github.com/keymetrics/pm2-io-apm)


## Bug Fixes
  - return the configuration and allow custom conf to override default values
  ([37dc7de1](https://github.com/Unitech/pm2/commit/37dc7de11e930aa4fce6a485e892f11ee714acd6))
  - add use strict for node 4 compatibility
  ([ba2ee3b1](https://github.com/Unitech/pm2/commit/ba2ee3b1ea9aa5fa665e706b3d49a205eac44d53))
  - #3605 fix parameters definition, don't use camelcase for properties
  ([c8616276](https://github.com/Unitech/pm2/commit/c8616276e4e08b4d90a742e219372e775bb81098))
  - #3695 change version check method in order to make it work with alpha/beta versions
  ([052d6c55](https://github.com/Unitech/pm2/commit/052d6c55df0e941e1dd11430bbcbcaa34061a06e))
  - deprecated warning on isbinaryfile
  ([db09275f](https://github.com/Unitech/pm2/commit/db09275f8e353e257c89e12fed754236b15cee74))
  - #3688 test adaptation + pm2 serve --port option
  ([f0249684](https://github.com/Unitech/pm2/commit/f0249684bcbfdb75749a516f447c8e8d32020709))
  - startup script issue 18.04 #3645
  ([ff1a7f31](https://github.com/Unitech/pm2/commit/ff1a7f315bfee38eb9fd9cdd63efcc0d971585f8))
  - that this - uncache node_modules
  ([294038d7](https://github.com/Unitech/pm2/commit/294038d76272a915e3addc67d3694717a9f7d704))
  - verify default conf variable via package.json on public module
  ([157b106d](https://github.com/Unitech/pm2/commit/157b106df78af1d28d37bbea069b926de4dceca5))
  - bug because of const
  ([56f05a90](https://github.com/Unitech/pm2/commit/56f05a900b03fb0c8dd635aede666c7d2f213271))
  - do not run two pm2 para cmds
  ([3274132b](https://github.com/Unitech/pm2/commit/3274132b866ba5c93d5786e755acbada922f5f1e))
  - version
  ([3ec178e5](https://github.com/Unitech/pm2/commit/3ec178e577e79730aae02c913301cd905ea8ce52))
  - re-enable agent tests
  ([e6febcd7](https://github.com/Unitech/pm2/commit/e6febcd70dd0f1e68b74df8563d3046ee3b32b89))
  - test/display summary
  ([b075e6d0](https://github.com/Unitech/pm2/commit/b075e6d09b09ff371adf045dc5079bb8ef82f1cf))
  - skip interactor tests
  ([36c4d6bc](https://github.com/Unitech/pm2/commit/36c4d6bca7445b46afc1236dc8ab4b8bf921148b))
  - remove unused tests
  ([234c6314](https://github.com/Unitech/pm2/commit/234c63143e723a508796bc1d323c7241979bf4c2))
  - add missing libraries in travis
  ([88fbb845](https://github.com/Unitech/pm2/commit/88fbb84597cee7029ce33f5b7e20e45f5a815b4b))
  - remove unused variable when trying to use tracing
  ([3aeeba02](https://github.com/Unitech/pm2/commit/3aeeba02f628bf4f19e8d5b93657fd94a6ef0ec7))
  - remove useless tests from .sh
  ([e0be81c8](https://github.com/Unitech/pm2/commit/e0be81c86c7defb5e7a271edd5cc37f960c6aa69))
  - conflict
  ([e13f39c9](https://github.com/Unitech/pm2/commit/e13f39c90b6a5e803c59c5424332520564703f5c))
  - fix bug with interpreter args
  ([b26efa0d](https://github.com/Unitech/pm2/commit/b26efa0d4cd72cf04762df7b7d2eaddc4f4117d2))
  - improve error message if action has failed
  ([d9f44f17](https://github.com/Unitech/pm2/commit/d9f44f170f115c2d6dfb6a7fe71dc31bd7fb66fb))
  - use polyfill module for copySync with node 4.x
  ([bc07f43b](https://github.com/Unitech/pm2/commit/bc07f43b115066f6077606df8f59379777f2a917))
  - improve error message if action has failed
  ([dacc6542](https://github.com/Unitech/pm2/commit/dacc654207cbe494af0d12a3f9f27c3b16541802))
  - solve empty list when no process and try to update pm2
  ([89511846](https://github.com/Unitech/pm2/commit/8951184688c720ded5b4b46bd5b393c3793f9b03))
  - #3485 fix issue when there is empty dump file
  ([f2523f6a](https://github.com/Unitech/pm2/commit/f2523f6a6b9d8b61ba6ace7b89a0353bee76360b))
  - #3456 use homedir() instead of process.env.HOME, make module installation work on windows
  ([1e001732](https://github.com/Unitech/pm2/commit/1e0017325fc8cf658263fb4e02c7bf8912f422b3))




## Features
  - add support for openbsd rc.d init scripts
  ([fdeb0c32](https://github.com/Unitech/pm2/commit/fdeb0c327afd91b113b214c4c4de187848f9f1cb))
  - add kill_retry_time argument
  ([b2cc0031](https://github.com/Unitech/pm2/commit/b2cc003114b44f1a9a31876ee4a2f4cb91e210b3))

  - **bin/pm2**
    - improve usage
  ([2c310084](https://github.com/Unitech/pm2/commit/2c310084453dd7b1546957e59b1fc7ef964d425b))




## Refactor
  - use @pm2/js-api for login/register on pm2.io via CLI
  ([cb6521ac](https://github.com/Unitech/pm2/commit/cb6521ac32f4737c42fc97fef972960bfe16c829))
  - keymetrics examples
  ([109b331d](https://github.com/Unitech/pm2/commit/109b331ddf37e061d1890ef952f4cd167ce53f64))
  - faster cli with less require
  ([ee5e6a06](https://github.com/Unitech/pm2/commit/ee5e6a06cbf93f2d1fa7fa022d6bdcad55a39695))
  - replace fs-extra with node calls
  ([4576b4c9](https://github.com/Unitech/pm2/commit/4576b4c97bc685c9d774018d6b29c918abd7cb8d))
  - centralize SECRET/PUBLIC/MACHINE_NAME + change some wordings
  ([d0a2a30e](https://github.com/Unitech/pm2/commit/d0a2a30e4110496b178199fb33e026d6402dd00d))
  - remove test deported to keymetrics-agent
  ([299a52a2](https://github.com/Unitech/pm2/commit/299a52a253d70edcde23cbd7e0c201d492984df4))
  - parallel test v1
  ([08612de5](https://github.com/Unitech/pm2/commit/08612de5b7893a004ae33ed77fcb2ee3ff7b2251))
  - e2e test rewrite
  ([2b9ffd4e](https://github.com/Unitech/pm2/commit/2b9ffd4eb493f1ff32c979e3811f4f1fedfae97d))
  - drop gracefullreload
  ([bb57c76d](https://github.com/Unitech/pm2/commit/bb57c76d4191343925013d4353299092d80732c9))
  - add node 4.x support
  ([d322dd00](https://github.com/Unitech/pm2/commit/d322dd00de0f527224c027b4fec5e86f12fd69ed))
  - create alias method instead of modify prototype
  ([6d8f0dfa](https://github.com/Unitech/pm2/commit/6d8f0dfae8106deb2fee0a7ae15b6ca9802a066d))
  - change safety var to const
  ([047aa494](https://github.com/Unitech/pm2/commit/047aa494d5c4dd4342915766b54d673db0d5cdf1))
  - drop some 0.x patch
  ([0cab8880](https://github.com/Unitech/pm2/commit/0cab8880ffa362cf27ab7d7b6a64d6b478dce7cd))
  - remove prototype from API and create method
  ([9552bd61](https://github.com/Unitech/pm2/commit/9552bd61b72692beb620a91765ad440cdf6abefe))
  - transform API into class
  ([e3831f95](https://github.com/Unitech/pm2/commit/e3831f95c8d71f98e8840da37f7e883727eccd59))
  - name tests well
  ([c3ccc651](https://github.com/Unitech/pm2/commit/c3ccc651d09ed7291090f516637b75bda99ff71c))
  - refactor e2e one line parallel
  ([93802711](https://github.com/Unitech/pm2/commit/938027117cdb2f300ee772ab27f008cbe22a4b19))
  - e2e rename
  ([8a7db95a](https://github.com/Unitech/pm2/commit/8a7db95aabc8437f292af0316cec81ab80ec41f5))
  - change params
  ([282186f2](https://github.com/Unitech/pm2/commit/282186f24b19b010999f7c7c49750935ef19c190))
  - parallelize bash test
  ([d4b4375e](https://github.com/Unitech/pm2/commit/d4b4375e16fe7ac463b252702da662d3a21bf8b4))




## Test
  - adapt test to new api
  ([7a275e27](https://github.com/Unitech/pm2/commit/7a275e279ea01b1239e9dd8b9cf8e088e407b96d))
  - refactor before/after
  ([b85ca3ca](https://github.com/Unitech/pm2/commit/b85ca3caa3c68e18f7ce6954cc85e90a9d33efef))
  - 3 concurrent jobs
  ([472aba34](https://github.com/Unitech/pm2/commit/472aba3499ff2d9d0eb834e819410026b1a44503))
  - move test
  ([9c973324](https://github.com/Unitech/pm2/commit/9c9733246dbe6afff1b488bc3ba3b6fea3877ea5))
  - move test
  ([952b7631](https://github.com/Unitech/pm2/commit/952b7631d19e1074ea73cc7a67bbaefe20950603))
  - fix test with km_link
  ([23fd8ecf](https://github.com/Unitech/pm2/commit/23fd8ecfea9b2bf61359f62a8e6e1a582c3b0d6e))




## Chore
  - shorten ecosystem file
  ([992a0452](https://github.com/Unitech/pm2/commit/992a045227aed559e708ac4e6bb3f54beabe48e0))
  - change motd wording
  ([aa183ba1](https://github.com/Unitech/pm2/commit/aa183ba19d88777d82619aa40499c2661d67879e))
  - merge master in development
  ([0e4453d9](https://github.com/Unitech/pm2/commit/0e4453d9cc789aa08ee778ff400572337e90d2e3))
  - keymetrics -> pm2
  ([2c8170c2](https://github.com/Unitech/pm2/commit/2c8170c25e231eb8827bb0944b76c2f4b041d84e))
  - upgrade all modules + keymetrics-agent -> pm2/agent + increase version enabling v8-compile-cache
  ([53ca18c1](https://github.com/Unitech/pm2/commit/53ca18c12868ab177b60a4edff2ccaa8127e301f))
  - pm2.io -> @pm2/io
  ([ae098962](https://github.com/Unitech/pm2/commit/ae098962df35eee7f482dc0a514fd29a02a5f4ad))
  - right names as pm2 maintainers
  ([e8cd7131](https://github.com/Unitech/pm2/commit/e8cd7131a6b9c9d497a2079bcbfc03770a753a06))
  - add changelog generation into contributing.md
  ([d77bfbc3](https://github.com/Unitech/pm2/commit/d77bfbc3c8929851ee19ea604b2a6481d03771e3))
  - cache node_modules
  ([81627e94](https://github.com/Unitech/pm2/commit/81627e94c72efa1f4d726e20bbf67f0bbd5c116f))
  - clone last 5 commits
  ([dad38ed1](https://github.com/Unitech/pm2/commit/dad38ed1bae849147f66e44186cd71c4b9cb022d))
  - delete old stagnating pmx inside test
  ([36834c2c](https://github.com/Unitech/pm2/commit/36834c2c00d496e04c38abaca30202eb650015c4))
  - pmx -> pm2.io
  ([adcbebc3](https://github.com/Unitech/pm2/commit/adcbebc3f6419cd97c5ea99f3c3a6789585bda66))
  - updgrade pmx-2
  ([eeeb2988](https://github.com/Unitech/pm2/commit/eeeb2988f8886e405aea107db3b888fc1fc929f8))
  - disable legacy test
  ([13723bd9](https://github.com/Unitech/pm2/commit/13723bd938d0e6fb1cbf35f15eabe91c52d87b58))
  - remove test for pmx alert system
  ([c43414a6](https://github.com/Unitech/pm2/commit/c43414a63438d724b8099eb531ec72bab23b8ca2))
  - sync from master
  ([3424ee27](https://github.com/Unitech/pm2/commit/3424ee27870feaf62fdf4509cce9015f8b1a8a2e))
  - add unique id for each process
  ([85a5ee0f](https://github.com/Unitech/pm2/commit/85a5ee0f1fd16da9635fb4b16ddcd8d53aca8224))
  - use npm install for CI as yarn has issue with npm
  ([52902186](https://github.com/Unitech/pm2/commit/5290218626af815f6cae8173bc78d21881a4dda8))
  - remove unused dependency
  ([830fc15f](https://github.com/Unitech/pm2/commit/830fc15fad1aee95e65b2681482b03369f1f97d7))
  - upgrade PM2 to 3.0
  ([4bc2eb4c](https://github.com/Unitech/pm2/commit/4bc2eb4c9a8179b9ae38438e98ce7650a91b64db))
  - remove unused console.log
  ([33db5084](https://github.com/Unitech/pm2/commit/33db5084814ae7940c90b7f933f9514d28008b78))
  - wording on error message
  ([c251c8c9](https://github.com/Unitech/pm2/commit/c251c8c97e6f18aae584cac6b7f3c83cf4f2de9c))
  - revert PR #3496
  ([aae1d55e](https://github.com/Unitech/pm2/commit/aae1d55e410c4dcfbbca83eaabbdf1a65d55f3aa))
  - fix issue with snapshot command + remove command forceGc
  ([97fd1010](https://github.com/Unitech/pm2/commit/97fd1010d005e59f2411042fa95891f9717fa8b7))
  - wording on error message
  ([5f78ecbf](https://github.com/Unitech/pm2/commit/5f78ecbf90f9f46a7feb2a169968e86b0ecac91e))
  - drop 0.12 test on travis
  ([beb6e487](https://github.com/Unitech/pm2/commit/beb6e48787c39c66569141d0fd8d090736114d23))
  - downgrade promptly
  ([074a7a40](https://github.com/Unitech/pm2/commit/074a7a407a31b4d88442f5834d253d62f4e543b8))
  - remove coffee and livescript dependencies
  ([13d6565c](https://github.com/Unitech/pm2/commit/13d6565c72e3596d05f87bfc8be15d3ee45fb279))
  - upgrade module version and engine version
  ([84796956](https://github.com/Unitech/pm2/commit/84796956347ca638750fe89cb5545e2a90a0f2c2))




## Branchs merged
  - Merge branch 'development' into chore/dev-cache-node-modules
  ([146c4e11](https://github.com/Unitech/pm2/commit/146c4e113c88e8ade17c7558c8e14cf523a3b2d6))
  - Merge branch 'development' of https://github.com/Unitech/pm2 into new-agent
  ([3514e7fa](https://github.com/Unitech/pm2/commit/3514e7fac624bb83b4cc22651ebc05385f9c284d))
  - Merge branch 'development' into master
  ([f5668331](https://github.com/Unitech/pm2/commit/f5668331dbe7346304258317a3b84450f421ed03))
  - Merge branch 'development' into new-usage-cli
  ([4ae27694](https://github.com/Unitech/pm2/commit/4ae27694e34c4bc6ed389566d71fc5ec48b69652))
  - Merge branch 'Eywek-improv/agent' into new-agent
  ([3e259dd1](https://github.com/Unitech/pm2/commit/3e259dd1d6bb96ea41897c49f3a84557c00c7dad))
  - Merge branch 'ecosystem-documentation' of github.com:rmonnier/pm2 into ecosystem-documentation
  ([98348955](https://github.com/Unitech/pm2/commit/98348955a6eb3a9cd524b991bd1dd6ed03d2c857))
  - Merge branch 'development' into ecosystem-documentation
  ([40157784](https://github.com/Unitech/pm2/commit/40157784a63bcb0e744d4ed56f6c687e28379fdd))
  - Merge branch 'inspect_mode' of github.com:Unitech/pm2 into inspect_mode
  ([7e1494c7](https://github.com/Unitech/pm2/commit/7e1494c7f7971aaf1f4d00d2ee691c3c41775001))
  - Merge branch 'development' of github.com:Unitech/pm2 into development
  ([48f81a8b](https://github.com/Unitech/pm2/commit/48f81a8b2f6f0db39edd86083fb369b74845c387))
  - Merge branch 'development' into master
  ([47e54109](https://github.com/Unitech/pm2/commit/47e5410987ab3d824a34c062d70c24ab686e57db))
  - Merge branch 'development' into module_install_windows
  ([7b82fb91](https://github.com/Unitech/pm2/commit/7b82fb916ed453c1c263bae43c962f6a5294d810))
  - Merge branch 'development' into module_install_windows
  ([80b0495f](https://github.com/Unitech/pm2/commit/80b0495f63d1224b850af4b14cdeb055e3fef50b))




## Pull requests merged
  - Merge pull request #3726 from soyuka/fix-list
  ([0255c5a6](https://github.com/Unitech/pm2/commit/0255c5a6ab1b8a8f609d2183d998695b8c42838d))
  - Merge pull request #3725 from soyuka/fix-list
  ([a39eb4f8](https://github.com/Unitech/pm2/commit/a39eb4f806e87565f53758a19f0ee289b6489b67))
  - Merge pull request #3718 from AaronM04/openbsd-init-script
  ([85458261](https://github.com/Unitech/pm2/commit/85458261d2673c609cb252d64ad4dfbaa466d848))
  - Merge pull request #3721 from Unitech/io_conf
  ([70ec1f81](https://github.com/Unitech/pm2/commit/70ec1f81eae089f75e82723fde7b0b3926d0a9bc))
  - Merge pull request #3716 from Unitech/io_conf
  ([0bc000b9](https://github.com/Unitech/pm2/commit/0bc000b9aae7dd37b456bc2d4fbc9eb4a9f047ef))
  - Merge pull request #3714 from Unitech/definition
  ([d8cff0de](https://github.com/Unitech/pm2/commit/d8cff0dec5160a620d1512ff56726c073368d1a4))
  - Merge pull request #3700 from Unitech/report_error
  ([4b2cad40](https://github.com/Unitech/pm2/commit/4b2cad407b76994e978074a2a3825fe70656304d))
  - Merge pull request #3670 from Unitech/changelog
  ([4bcbcce1](https://github.com/Unitech/pm2/commit/4bcbcce16ced596f6ca2bab2b77d608a174a7c1a))
  - Merge pull request #3662 from DanielRuf/chore/dev-cache-node-modules
  ([540590ee](https://github.com/Unitech/pm2/commit/540590ee056b44eed3b688a7b0b16ca78ec82cd9))
  - Merge pull request #3663 from DanielRuf/chore/dev-clone-last-5-commits
  ([bdf95fc9](https://github.com/Unitech/pm2/commit/bdf95fc997f9ab2995b23668f25f11b6e98b5c47))
  - Merge pull request #3584 from ngtmuzi/development
  ([33984b64](https://github.com/Unitech/pm2/commit/33984b64a2969ca4a3a5913f0f7da0242b6c5ec1))
  - Merge pull request #3500 from Unitech/test-parallel
  ([da56c7af](https://github.com/Unitech/pm2/commit/da56c7aff18d3a38b3ad068b22cd75b290bac9d0))
  - Merge pull request #3539 from KimSeongIl/master
  ([1325704d](https://github.com/Unitech/pm2/commit/1325704d95d324e56b0ebc86aed8137e0d0aa450))
  - Merge pull request #3556 from N-Nagorny/logs-smart-app-name-cutting
  ([bfddf4fd](https://github.com/Unitech/pm2/commit/bfddf4fdef5ec293119d850cc2532ac5d6490ae3))
  - Merge pull request #3553 from Unitech/fix_tracing_not_working
  ([9d51fe08](https://github.com/Unitech/pm2/commit/9d51fe0819182339f3a6a4aee7ea603ea3f4dd76))
  - Merge pull request #3549 from Eywek/new-agent
  ([2f04027b](https://github.com/Unitech/pm2/commit/2f04027b536094d192b399677b3a113102f06b8e))
  - Merge pull request #3548 from rmonnier/start-ecosystem-default
  ([55412f26](https://github.com/Unitech/pm2/commit/55412f263250395de0085144932cfe06b8c7180d))
  - Merge pull request #3546 from soyuka/improve-monitor-perf
  ([e4e29233](https://github.com/Unitech/pm2/commit/e4e29233f99db36462a6e8f48eb8ebd3d2fd9fa5))
  - Merge pull request #3534 from rmonnier/new-usage-cli
  ([5dfba8a4](https://github.com/Unitech/pm2/commit/5dfba8a4491f0bb83f2879915f0c4b164be2552c))
  - Merge pull request #3542 from rmonnier/default-start-ecosystem
  ([c65595f4](https://github.com/Unitech/pm2/commit/c65595f4a70659e1e0d753e6c28a1fcedf45a91a))
  - Merge pull request #3545 from rmonnier/default-ecosystem
  ([b3718656](https://github.com/Unitech/pm2/commit/b3718656f630aa54880343d9742534a2a508daec))
  - Merge pull request #3543 from rmonnier/ecosystem-documentation
  ([a60580a1](https://github.com/Unitech/pm2/commit/a60580a12b4a0066c8df6620317fbc8bf599b0b6))
  - Merge pull request #3541 from soyuka/development
  ([67e7a015](https://github.com/Unitech/pm2/commit/67e7a015cabaa7b08206a3b1bf9c0399af88f76b))
  - Merge pull request #3511 from Unitech/inspect_mode
  ([75fb87f8](https://github.com/Unitech/pm2/commit/75fb87f8a1c46a6db8e974b421e857175e69b535))
  - Merge pull request #3517 from Unitech/polyfill_fs_copy_node4
  ([524f5494](https://github.com/Unitech/pm2/commit/524f54948de5080632d43bb512038d7bd7271619))
  - Merge pull request #3516 from Unitech/drop_unused_feature
  ([9436f11a](https://github.com/Unitech/pm2/commit/9436f11aeecfc07e77aa9d6b108df4478b43402e))
  - Merge pull request #3510 from Unitech/dump_refacto
  ([674e4469](https://github.com/Unitech/pm2/commit/674e4469554e6a765bb3d57a3c083e6ab53b20cc))
  - Merge pull request #3501 from Unitech/refactor_api
  ([9f2c4ca4](https://github.com/Unitech/pm2/commit/9f2c4ca4c9eadf6c7730e3889c72e908cd2d8f5d))
  - Merge pull request #3496 from rmonnier/master
  ([829cc303](https://github.com/Unitech/pm2/commit/829cc3032b2d61e20f7a2e7d1d819c0ddc0845e8))
  - Merge pull request #3484 from Unitech/pull_by_name
  ([24d29404](https://github.com/Unitech/pm2/commit/24d294049008a0d01b2bc407b9b2b880d5843fbd))
  - Merge pull request #3482 from Unitech/mjs_support
  ([ebe7b048](https://github.com/Unitech/pm2/commit/ebe7b0487218557858aaa98527360eca1776b140))
  - Merge pull request #3495 from Unitech/module_install_windows
  ([e9c625d3](https://github.com/Unitech/pm2/commit/e9c625d3088c71eef4237ecd866b806957c61815))
  - Merge pull request #3507 from cheapsteak/patch-1
  ([a49287d6](https://github.com/Unitech/pm2/commit/a49287d6a1d22b39270e2d05dee2a17c0ed55797))




## 2.10.4 ( Thu May 17 2018 14:32:40 GMT+0200 (CEST) )


## Bug Fixes
  - #3645 throttle startup
  ([d529f675](https://github.com/Unitech/pm2/commit/d529f675d0240777cba95442ba35205c370cdb43))




## Chore
  - update issue and PR templates to use comments to hide instructions in the frontend
  ([9e0180ed](https://github.com/Unitech/pm2/commit/9e0180eddab071916144ad7008817bd6aef1c8ce))




## Pull requests merged
  - Merge pull request #3664 from DanielRuf/chore/update-issue-pr-templates
  ([067446f2](https://github.com/Unitech/pm2/commit/067446f2133ba7f761b0ad3c9f3692b167affd8b))


## v2.10.3 ( Fri Apr 27 2018 11:42:16 GMT+0200 (CEST) )


### Chore
  - upgrade for node 10
  ([cf7630e](https://github.com/Unitech/pm2/commit/cf7630e259742bdff8257cff4dbed2732bf24f9c))

## v2.10.2 ( Thu Mar 29 2018 13:06:11 GMT+0200 (CEST) )


## Bug Fixes
  - reinforce pm2-runtime auto exit strategy #3567 #3206
  ([e09cdbab](https://github.com/Unitech/pm2/commit/e09cdbabd0b479acda3cb24154bbaa071aa35407))




## Pull requests merged
  - Merge pull request #3569 from Unitech/pm2-runtime-hot-fix
  ([473a2d6d](https://github.com/Unitech/pm2/commit/473a2d6d3867c617e4a41571d1780618c5025b87))
  - Merge pull request #3547 from Unitech/revert-3532-logs-smart-app-name-cutting
  ([438e3030](https://github.com/Unitech/pm2/commit/438e303013e82ecc199cb68d018144cde8a0b2e6))
  - Merge pull request #3532 from N-Nagorny/logs-smart-app-name-cutting
  ([067c18e6](https://github.com/Unitech/pm2/commit/067c18e601aca4fac10101a7c23cc4c3525ad776))



## v2.10.1 ( Mon Feb 26 2018 11:38:18 GMT+0100 (CET) )


## Bug Fixes
  - restore --raw option #3476
  ([340011ca](https://github.com/Unitech/pm2/commit/340011cace2b90c2a1ead8d86baba517f5570e15))


## v2.10.0 ( Mon Feb 19 2018 14:51:19 GMT+0100 (CET) )


### Bug Fixes
  - add livescript in default modules
  ([a315eeb6](https://github.com/Unitech/pm2/commit/a315eeb65f04b22643a903f0cb1c0f416615ad8b))
  - replace dash with underscore
  ([203df768](https://github.com/Unitech/pm2/commit/203df7688ca348967c00bc45289ae70fd2c4aaaa))
  - make sure not pm2 is running
  ([bd798fd7](https://github.com/Unitech/pm2/commit/bd798fd748665e935db4bb91f9d1d66952d9842a))
  - auto-exit edge case fix + pm2 no daemon mode + log in raw by default + less logs
  ([704ae518](https://github.com/Unitech/pm2/commit/704ae518f5d7df0a631349e518d81cef51249a58))
  - impact v8 flag in fork mode also
  ([41bf6ef7](https://github.com/Unitech/pm2/commit/41bf6ef7d3633180b4c1e90f36eb206d82fab2b1))
  - fixup! #2182 Get rid of annoying popups in Windows 10
  ([3a85b59d](https://github.com/Unitech/pm2/commit/3a85b59de4a76796ad0880368d8d085a7ba55d36))




### Hot Fixes
  - \#3420 ([673acf36](https://github.com/Unitech/pm2/commit/673acf36b4ca1fd65c5135a92d56081f76237a8b))




### Features
  - add dependencies section into ecosystem.json file.
  ([828a30d0](https://github.com/Unitech/pm2/commit/828a30d0ccc88b3f6e2b66d517ccf5f2394bd08b))
  - --deep-monitoring available from pm2-runtime
  ([99e62e3b](https://github.com/Unitech/pm2/commit/99e62e3bb808f071d6e4850c234b34f7de65b1c2))
  - add deep_metrics to deep_monitoring flag
  ([4d1bea5e](https://github.com/Unitech/pm2/commit/4d1bea5e0bbaab1f16f75d012bca25702cdff88e))
  - add flag to enable deep-monitoring
  ([c5418688](https://github.com/Unitech/pm2/commit/c541868837a1c4421394de5dd1029d2619b5ac82))
  - allow pm2 to install a set of module as one single command and add deep-monitoring.
  ([9dddc80d](https://github.com/Unitech/pm2/commit/9dddc80db5e496def44d4d36716b7de54e5171cf))
  - pm2 pid <app_name> command
  ([6687d499](https://github.com/Unitech/pm2/commit/6687d499415151bd62489fed5331f414576ec354))
  - allow pm2 to install and enable event-loop-inspector data collecting
  ([e6b0c474](https://github.com/Unitech/pm2/commit/e6b0c47443d3e6a839bf29057ef0a80ef135c47e))
  - ignore signal when running in --no-daemon
  ([b9c01c99](https://github.com/Unitech/pm2/commit/b9c01c99d54aba98ab790b8888500ac0f0af05c9))
  - upgrade pmx to git development branch
  ([21be05a0](https://github.com/Unitech/pm2/commit/21be05a07bd93eacaddedde3b647c16468937473))
  - allow pm2 to enable v8 data collecting from pmx
  ([aa180fa8](https://github.com/Unitech/pm2/commit/aa180fa8ab47f0c687d7c21854d005ad0ebf8475))
  - allow pm2 to install gc-stats
  ([15634168](https://github.com/Unitech/pm2/commit/15634168582e4c7b3c5f47a3f58a0fcf8b732a76))
  - feat add changelog generation support
  ([14f53fc0](https://github.com/Unitech/pm2/commit/14f53fc0c28be4084778785aeace3763ed0d827f))

  - **pm2**
    - add pm2 init option to generate an ecosystem file
  ([5d56fac7](https://github.com/Unitech/pm2/commit/5d56fac7cc12590af29ee46c68ba32a82a2b813b))
    - add pm2 init option to generate an ecosystem file
  ([a38fd199](https://github.com/Unitech/pm2/commit/a38fd199b90d27a2405f8cabab0e4f6e45c69b08))




### Documentation
  - add documentation on new pm2 install command
  ([c90c453f](https://github.com/Unitech/pm2/commit/c90c453f85b07adb346bc55c2b685d689a2e96f7))
  - add sendDataToProcessId into typescript definitions
  ([4a2e8d2d](https://github.com/Unitech/pm2/commit/4a2e8d2d2c4b38fe0ff2377dfe32fce9a43c8044))




### Refactor
  - delete all "if" condition when installing new module, create an object with all modules and a generic installation process
  ([1b92a9c4](https://github.com/Unitech/pm2/commit/1b92a9c4000734367e68d8dbd60d0901009f4c56))
  - deep pm2-runtime refactor #3408 #3257 #3266
  ([c13b2364](https://github.com/Unitech/pm2/commit/c13b23648269529a1f998d816be10f895665861e))
  - no more interactive spinner for connection to KM + change pm2 log format + remove some logs
  ([d1916f40](https://github.com/Unitech/pm2/commit/d1916f40962b2cc8a1866172eab7d5d89db093be))




### Chore
  - pmx to 1.6.3-rc2
  ([41815e0b](https://github.com/Unitech/pm2/commit/41815e0ba0298979f936b3d4badb196f8d9783d8))
  - switch pmx to development
  ([748019d1](https://github.com/Unitech/pm2/commit/748019d1ef0cf760b5e8de9d5b6af6fee300db02))
  - 2.10.0-beta
  ([0d2b7172](https://github.com/Unitech/pm2/commit/0d2b7172a093d0638deabb5f23383cc9eec5dda9))
  - upgrade pmx to 1.6.3-next
  ([5a1b4343](https://github.com/Unitech/pm2/commit/5a1b4343cc1e1f5018e21451a111340351706213))
  - upgrade pmx dep
  ([4bbeec3d](https://github.com/Unitech/pm2/commit/4bbeec3d170ba63af0c0ae0e2d07beec2ab49772))
  - switch to published pmx(@next)
  ([859d18fb](https://github.com/Unitech/pm2/commit/859d18fbc79e2a2760fe90e9c17e71209f8177ce))
  - remove --exit from mocha.opts
  ([36bf03e1](https://github.com/Unitech/pm2/commit/36bf03e1eed69a27e518151e2f7aa958b15db2fb))
  - remove unused files
  ([65d233e5](https://github.com/Unitech/pm2/commit/65d233e5b5290f65796b7cf3daa20706e0f3bee6))




### Branchs merged
  - Merge branch 'development' of ssh://github.com/deltasource/pm2 into hotfix/scoped-package-support
  ([94ea9d9e](https://github.com/Unitech/pm2/commit/94ea9d9eeff40faca8aa9f7edfc81aa29c08e740))
  - Merge branch 'master' into development
  ([46606903](https://github.com/Unitech/pm2/commit/46606903f25d0f4d0eee226da863e20e4b396dc9))
  - Merge branch 'development' of github.com:Unitech/pm2 into v8_option
  ([757562f7](https://github.com/Unitech/pm2/commit/757562f755b09124bbd006209ae38a096d692529))
  - Merge branch 'development' of github.com:Unitech/pm2 into gc-stats
  ([3ed1a747](https://github.com/Unitech/pm2/commit/3ed1a7471aec7d79f7d604447ac7445720bdaced))
  - Merge branch 'master' into development
  ([ee7651e4](https://github.com/Unitech/pm2/commit/ee7651e47e944c3c829933494c6cc765deb4bb29))




### Pull requests merged
  - Merge pull request #3466 from natcl/development
  ([c6d7ace8](https://github.com/Unitech/pm2/commit/c6d7ace802e667def75bc68344effa4856830fb4))
  - Merge pull request #3464 from andyfleming/patch-1
  ([dd9ebb60](https://github.com/Unitech/pm2/commit/dd9ebb6051708ee5a13cc68dbcb8238e41860bb9))
  - Merge pull request #3459 from rmonnier/master
  ([46948a98](https://github.com/Unitech/pm2/commit/46948a98e90c7864f7b8100db5c519fe9d37f11a))
  - Merge pull request #3458 from Unitech/pm2_install_command
  ([f3b35726](https://github.com/Unitech/pm2/commit/f3b35726895bd82b92813f308b787d68e9df1fa4))
  - Merge pull request #3453 from deltasource/hotfix/scoped-package-support
  ([974f9bf0](https://github.com/Unitech/pm2/commit/974f9bf0dc7a7aa7ff6860f8640da3593b802296))
  - Merge pull request #3448 from Unitech/deep_monitoring_flag
  ([331bc741](https://github.com/Unitech/pm2/commit/331bc741d7285094738a91cd816bc9755cc76605))
  - Merge pull request #3447 from Unitech/deep-monitoring
  ([719d328e](https://github.com/Unitech/pm2/commit/719d328e8d14871b34fd33df54fd80f4f8e7825f))
  - Merge pull request #3443 from Unitech/event-loop-inspector
  ([77a35274](https://github.com/Unitech/pm2/commit/77a3527407f3d090c7a5fa0bedaf943a7536b5eb))
  - Merge pull request #3442 from Unitech/event-loop-inspector
  ([dad98e6e](https://github.com/Unitech/pm2/commit/dad98e6e0738983717fee155ff0f6519955ffc1b))
  - Merge pull request #3424 from Unitech/sendDataToProcessId_def
  ([95e85eef](https://github.com/Unitech/pm2/commit/95e85eef84510dddfb0c6b13f0ada38a7dd66cae))
  - Merge pull request #3438 from Unitech/v8_option
  ([e46b15dc](https://github.com/Unitech/pm2/commit/e46b15dc32c18e8b24f66da0c79cc06f91cf11b5))
  - Merge pull request #3437 from Unitech/gc-stats
  ([1a6771aa](https://github.com/Unitech/pm2/commit/1a6771aa361bb5718bafd6e33e616725f9c0d328))
  - Merge pull request #3400 from toddwong/windowsHide2
  ([f65e8794](https://github.com/Unitech/pm2/commit/f65e8794df6e67f4ff60dfbec7c05a37721cb6f9))
  - Merge pull request #3421 from Unitech/generate_changelog
  ([b0690618](https://github.com/Unitech/pm2/commit/b0690618d940c11e28eeb5115c060bf363c7b62b))
  - Merge pull request #3419 from Rohja/fix-build-number-deb-rpm
  ([b4343de2](https://github.com/Unitech/pm2/commit/b4343de2703fce03f3cf48cc303b12bc6b69b743))




## 2.9.2

- #3364 30% faster CLI via v8-compile-cache

- add process._getActiveRequests() and process._getActiveHandles() custom metrics
- #3402 #3360 fix bad username
- #3413 check dependencies before launching tests
- #3295 add sorting feature for process list (pm2 ls --sort <field_name:order>)
- #3404 if no gid specified - set gid to uid
- #3287 add typing for env
- #3374 separate stdout and stderr for pm2-docker/pm2-runtime
- #3366 improve building of rpm and deb packages
- #3375 sendLineToStdin/sendDataToProcessId fix
- #3365 fix report command for windows
- #3367 Display an error if the process is not found when running 'pm2 logs <process-name>'
- #3256 TypeError: Cannot read property 'destroy' of undefined
- User: append SUDO_USER if no uid has been set and SUDO_USER present
- User: check permission of agent
- KM: send outliers
- KM: infinite retry for km connection

## 2.9.1

- #3356 hot fix on startup system

## 2.9.0

- #3278 --silent -s now does not print welcome message
- #3345 #2871 #3233 pm2 -v will not spawn daemon anymore
- #3341 update moment dependency
- #3314 pm2 install <MODULE> --safe will now monitor new installation of module and will
  fallback to previous version if the module is failing (restart, fail on npm install)
- #3314 module folder structure refactoring to keep independent dependencies for each modules
- #3324 remove yarn installation of modules
- #3273 pm2 --mini-list now print the right pid file
- #3206 add flag to auto turn off auto exit with pm2-docker
- #3036 Fix applying env PM2_CONCURRENT_ACTIONS correctly
- #3346 do not chmod systemd script (was failing systemd script on orange pi)
- #3347 Add --wait-ip option to override systemd initialization to wait for internet full connectivity
- #3348 alias pm2-docker to pm2-runtime
- #3350 Override HOME and USER when setting --uid to start module or application
- #3351 alias pm2 ps to pm2 ls (docker style)

## 2.8.0

- #2070 Fix sendDataToProcessId not working (@h091237557)
- #2182 Add windowHide options in cluster mode (@soyuka)
- #3206 By default in docker, pm2 will auto exit when no process are online (@dguo)
- #3225 fix --lines accepting invalid values (@vmarchaud)
- #3036 fix when PM2_CONCURRENT_ACTIONS was overriden everytime on node > 4 (@danez)
- Add node 9 tests on CI (@Unitech)
- Add pm2 unlink command (eq to pm2 link delete) (@Unitech)
- Fix interactor to support custom endpoints (@vmarchaud)
- Allow custom PM2_HOME for docker (@lucidNTR)
- Support MJS module (@vpotseluyko)
- Allow custom service name for startup (@danez)
- Update PMX to 1.5 (@unitech)

## 2.7.2

- #3200 Associate .tsx files with ts-node (@dguo)
- #3202 Add first draft of typescript definitions (@jportela)
- Allow to install http url via pm2 install (@unitech)
- #3204 Given --uid add all its gids automatically (@jmeit)
- #3184 bugfix: try/catch around userInfo to avoid crash (@vmarchaud)
- #3181 force upgrade to latest pm2-deploy

## 2.7.1

- #3117 Add required node env on cluster mode start instance (2m0nd)
- make profiler compatible with Node.js 8

## 2.7.0

- #3150 fix watchdog on agent
- #3001 dump-backup feature
- #3134 edge case error handling
- #3096 fix module installation
- #3085 honor every pm2 args on restart
- #3046 better error message if PM2 is misconfigured
- #3058 pm2-docker now does not write logs by default
- #3045 continue to broadcast on the bus system even if logs are disabled
- [Docker] Auto Exit when no application is running
- [Keymetrics] pm2 unmonitor fix
- [Beta Container Support] beta pm2 start app.js --container
- [Chore] upgrade modules
- [Chore] enhance package.json

## 2.6.1

- #3037 bug fix cb

## 2.6.0

### Changes

- #2998 pm2 report command for automated system inspection
- #2997 --disable-logs option to suppress error
- #2290 allow to declare apps under "pm2" attribute (eq "apps"). Nicer in package.json
- #2994 allow to specify typescript version to be installed
- #2501 low memory environment pm2 setting via PM2_OPTIMIZE_MEMORY (beta)
- #2968 pm2 attach <pm_id> to attach to process stdin / stdout
- pm2-runtime -> drop in replacement for the node.js binary
- #2951 pm2 reload command locker via timestamped lock file
- #2977 pm2 reloadLogs protected
- #2958 Allow to delete attribute via --attribute null
- #2980 PM2_SILENT=true pm2 startup
- #2690 --parallel <number> command allows to change the nb of concurrent actions (reload/restart)
- expose cwd on CLI via --cwd
- multiple pm2-docker enhacements
- Alias pm2.link and pm2.unlink to pm2.interact and pm2._pre_interact
- Allow to customize kill signal via PM2_KILL_SIGNAL
- Support git+http in module installation
- force reverse interaction reconnection on internet discovery
- `--instances -1` when having a 1 cpu is no-longer spawning no processes #2953
- refactor the context retrieving from error
- add a TTL for file cache entry
- #2956 Fix listen_timeout in combination with wait_ready
- #2996 respect signal order on pm2 reload (delegate ready function to reload fn)

### Breaking

- Drop pm2-daemon CLI (replaced by pm2-runtime)

## 2.5

- `pm2 register|login` to create new account / login on Keymetrics + auto link
- `pm2 open` to open dashboard on browser
- `pm2 monitor|unmonitor <pm_id|name|all>` for selective monitoring
- #2818 alias pm2-docker to pm2-daemon
- #2809 correctly resolve git/npm repo when running pm2 install
- #2861 better auto exit check for docker
- #2870 avoid null error when preparing app config
- #2872 avoid showing useless warning
- #438 allow to override daemon config paths via env (example: `PM2_PID_FILE_PATH` to override pid file of the daemon)
- #2849 better gentoo template for pm2 startup
- #2868 allow tailing log with `--raw` flag
- #452 Add `PM2_WEB_STRIP_ENV_VARS` to remove environnement vars from `pm2 web` endpoint
- #2890 Fix wait-ready for cluster mode
- #2906 randomize machine name with default pm2 link
- #2888 allow to use regex for pm2 logs
- #2045 allow to rename NODE_APP_INSTANCE env variable
- #2809 add `increment_var` options to ask for a environnement variable to be incremented for each application started
- more informations when failing to deploy on custom ecosystem file
- fix tests for node 8
- fix missing callback when overriding console.log
- allow to rename daemon process name via `PM2_DAEMON_NAME`
- few typo in the readme

### Breaking change

- the NODE_APP_INSTANCE var behavior has been changed :
    - old behavior : when starting multiples instances of an app each one get an unique number, but its not working anymore if you are using `pm2 scale` (simply put its possible to have two application with the same number)
    - new behavior : the number are consistent, if you scale up/down it will take a number that isn't used by another application (so two application should never have the same number)

## 2.4.5/6

- #2818 alias pm2-docker to pm2-runtime
- #2815 polyfill for path.isAbsolute for node v0.11

### Breaking change

- rundev command has been dropped because of too low adoption

## 2.4.4

- #2806 fix reconnection to keymetrics

## 2.4.3

- #2759 disable default require of vxx in pmx
- #2651 always spawn pm2 daemon with `node` binary
- #2745 new issue template
- #2761 Make JSON log stream timestamp in consistent format
- #2770 Fix trigger API never calling callback
- #2796 Fix absolute path on windows
- [KM] profiler installation via `pm2 install v8-profiler` or `pm2 install profiler`
- [KM] Agent rescue system

## 2.4.2

- [KM] Disable pm2-server-monit auto install

## 2.4.1

- #2720 multi user startup script
- #2266 start and tail logs via `pm2 start app.js --attach`
- #2699 add back previous termcaps interface via `pm2 imonit`
- #2681 fix log folder create
- #2724 make sure process is stopped even if there is a restart_delay
- #2706 install pm2 modules via yarn if available
- #2719 show 15 logs line bu default
- #2703 allow custom timestamp with pm2-docker
- #2698 fix unicode on pm2 monit
- #2715 handle treekill edge case bug
- Optimize CPU usage of pm2 monit command
- [KM] URL web access dashboard
- [KM] Auto install pm2-server-monit on keymetrics linking
- [KM] Error reporting: add context (-B3 -A3 code lines)
- [KM] Transaction Tracer: reset routes on app restart / wait some time before sending

## 2.4.0

- #2631 new pm2 monit command (blessed dashboard!)
- #2670 allow to expose a folder over http via `pm2 serve <path> <port>`
- #2617 fix startup script generation on macosx (launchd)
- #2650 new option to append env name to app name (used to allow the same app to be launched in different environment w/o name conflict)
- #2671 allow to pass a delay to pm2-docker (`pm2-docker process.json --delay 10`)
- `pm2 ecosystem simple` to generate a simple ecosystem file
- aliasing: `pm2-dev <script>` <=> `pm2-dev start <script>`
- fix git parsing when using cwd
- #2663 allow to directly output json when logging (via log_type for JSON and --log-type via CLI)
- #2675 fix path when installing language module like typescript
- #2674 increase restart timeout for systemd startup
- #2564 allow to operate process (restart/reload/stop/delete) with regex

## 2.3.0

- Drop Node.js 0.10 support
- (CLI) remove immutability of CLI parameters on restart (critical for ux)
- Keymetrics VXX beta
- Alias "exec" to "script"
- `pm2 logs --nostream` allow to print last logs of application without attaching to logs bus #2620
- Added startup script for gentoo v2.3 via PR #2625
- optionalDependencies from http to https
- remove agent pid on exit
- #2646 check ps.stdout on treekil

## 2.2.3

- Various startup refactor fixes (#2598, #2587, #2590)

## 2.2.2

- #2574 Support Amazon systemv

## 2.2.1 (rc: 2.2.0@next)

- #2559 New startup system. Supported init system: systemd, upstart, launchd

  $ pm2 startup   # Auto detect available init system + Setup init scripts
  $ pm2 unstartup # Disable and Remove init scripts

*SystemD, Upstart and Launchd scripts work like a charm*

- #2515 New way to install PM2 on Debian based system:

```
$ wget -O - http://apt.pm2.io/ubuntu/apt.pm2.io.gpg.key | sudo apt-key add -
$ echo "deb http://apt.pm2.io/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/pm2.list
$ sudo apt-get update
$ sudo apt-get install pm2
```

- #1090 pm2 resurrect does not respawn the same processes
- #2544 Attach logs to exception
- #2545 Right exit code via pm2 api
- #2543 Fix module pid/mem monitoring
- #2537 Remove duplicated code in Configuration subsystem
- Responsive pm2 list (shortened list when < 90 columns)
- If not TTY do not print ascii table
- #2509 Trigger functions inside Node.js application from the PM2 CLI
- Rename pm2.triggerCustomAction() by pm2.trigger(<app_id>, <action_name>, [params], [cb])

## 2.1.6

- #2509 Trigger functions inside Node.js application from the PM2 CLI
- #2474 Resolve home path in configuration file
- #2526 Expose .launchAll() method to API
- #2351 inner pm2 actions - drop autorestart and node_args options
- #2530 Make sure all processes are killed on system signal to PM2
- #281 allow to combine PM2_SILENT + pm2 jlist to avoid extra data
- Alias attributes error_file to err_file + err_log + err, alias out_file to out, out_log
- Do not ask for pass for set/multiset from KM

## 2.1.5

- #2502 fix SIGTERM signal catch on pm2-docker
- #2498 #2500 global log rotation

## 2.1.4

- #2486 add --web option to pm2-docker command to expose web process api
- #2333 #2478 #1732 #1346 #1311 #1101 Fix GracefulShutdown SIGINT output + Better Stop process flow
- #2353 --wait-ready will wait that the application sends 'ready' event process.send('ready')
- #2425 allow to specify node.js version to be used or installed via interpreter 'node@VERSION'
- #2471 Make app environment immutable on application restart/reload by default for CLI actions
- #2451 Config file can be javascript files
- #2484 fix pm2 kill on windows
- #2101 pm2 ecosystem now generates a javascript configuration file
- #2422 allow to pass none to exec_interpreter
- Faster CLI load time, reduce load time by 1/4 (downgrade cli-table2 -> cli-table)
- Do not use disconnect() anymore on cluster processes
- Better Stop process flow: Upgrade TreeKill system + Wait for check
- Fix deploy issue with Windows
- Expose -i <instances> to pm2-docker
- Drop npm-shrinkwrap
- Upgrade chokidar (fix symlink), cron, fclone, shelljs
- Add yarn.lock

## 2.0.19

- #2466 skip cluster workaround / fix cluster mode for Node.js v7
- Enable Node v7 in travis

## 2.0.16/17/18

- #2400 Create log/pid default folder even if the root folder is already created
- #2395 CRON feature now call PM2 for app to be killed (allow to use SIGINT)
- #2413 #2405 #2406 do not exit on unhandledRejection auto catch
- pidusage upgrade to 1.0.8 to avoid util exception on windows when wmic fail
- Do no display error when pidusage try to monitor an unknow PID (modules)
- pm2-docker binary does not need the start option

## 2.0.15

- process.on('unhandledRejection'): allow to catch promise error that have not been catched
- upgrade fclone and pidusage (faster windows CPU/Mem monitoring)
- allow to call pm2 CLI from bash script managed by pm2
- #2394 fix pm2 id command
- #2385 ts-node upgraded to latest
- #2381 autocompletion fix

## 2.0.12 Bradbury

- Memory usage reduced by 40%
- CPU usage in overall situations reduced by 60%
- Refined pm2 logs command with --json, --format and --raw options
- Faster process management with CONCURRENT_ACTIONs enabled
- Faster installation (v1: ~30secs, v2: ~10secs)
- Faster `pm2 update` with Keymetrics linking delayed at the end
- Much better Module system with raw NPM feedback
- Better Windows support
- **pm2-docker** command with his official [Docker image](https://github.com/keymetrics/pm2-docker-alpine) + json output + auto exit
- **pm2-dev -> pmd** command enhanced (better log output, post-exec cmd)
- Watch and Reload instead of Watch and Restart
- New PM2 API, backward compatible with previous PM2 versions

The new PM2 API is greatly tested and well designed:

```javascript
var PM2 = require('pm2');

// Or instanciate a custom PM2 instance

var pm2 = new PM2.custom({
  pm2_home :    // Default is the legacy $USER/.pm2. Now you can override this value
  cwd      :    // Move to CWD,
  daemon_mode : // Should the process stay attached to this application,
  independant : // Create new random instance available for current session
  secret_key  : // Keymetrics secret key
  public_key  : // Keymetrics public key
  machine_name: // Keymetrics instance name
});

// Start an app
pm2.start('myapp.js');

// Start an app with options
pm2.start({
  script   : 'api.js',
  instances: 4
}, function(err, processes) {
});

// Stop all apps
pm2.stop('all');

// Bus system to detect events
pm2.launchBus((err, bus) => {
  bus.on('log:out', (message) => {
    console.log(message);
  });

  bus.on('log:err', (message) => {
    console.log(message);
  });
});

// Connect to different keymetrics bucket
pm2.interact(opts, cb)

// PM2 auto closes connection if no processing is done but manually:

pm2.disconnect(cb) // Close connection with current pm2 instance
pm2.destroy(cb)    // Close and delete all pm2 related files of this session
```

- Better CLI/API code structure
- PM2 isolation for multi PM2 instance management

### Bug fixes

- #2093 #2092 #2059 #1906 #1758 #1696 replace optional git module with tgz one
- #2077 fix calling pm2.restart inside pm2
- #2261 GRACEFUL_LISTEN_TIMEOUT for app reload configurable via --listen-timeout
- #2256 fix deploy command for yaml files
- #2105 alias pm2 logs with pm2 log
- Extra module display http://pm2.keymetrics.io/docs/advanced/pm2-module-system/#extra-display
- Yamljs + Chokidar Security fixes
- pm2 update / pm2 resurrect is now faster on Node > 4.0
- keymetrics linking after pm2 update is done once all apps are started
- pm2 list processes are now sorted by name instead id
- #2248 livescript support added in development mode
- The client/server file called Satan.js does not exist anymore. It has been replaced by the file combo ./lib/Client.js and ./lib/Daemon.js
- PM2 --no-daemon is better now

### Breaking change

- Coffeescript must be installed via `pm2 install coffeescript`

## 1.1.3

- Node v6 compatibility

## 1.1.2

- [#2071 #2075] Fix pm2-dev command

## 1.1.0: Galactica release

This release is about PM2's internals refactoring, homogenization in action commands (in terms of behavior and outputs).
Some interesting features has been added, as YAML file support (for application declaration) and some syntaxic sugar.
The Keymetrics interface has been enhanced, dividing by two the memory usage and avoiding any possible leak in any potential scenarios. Reconnection system has been refactored too, we kindly ask our Keymetrics users to upgrade to this version ASAP.

**This version has been heavily tested in testing, production environments and deeply monitored in terms of CPU and Memory usage.**

- [#133 #1568] Allow to rename a process via pm2 restart app --name "new-name"
- [#2002 #1921 #1366] Fix CLI/JSON arguments update on restart (args, node_args, name, max-memory)
- [#578] Add YAML support for application configuration file (in extent to JSON and JSON5 support)
- [Keymetrics agent refactoring] TCP wait, memory consumption divided by two, reconnection refactoring, keep alive ping system
- [Keymetrics agent refactoring] Fix random no response from pm2 link and pm2 unlink
- [#2061] Kill ESRCH of processes in cluster mode with SIGINT catcher fixed
- [#2012 #1650 #1743] CLI/JSON arguments update on reload
- [#1613] Reload all reload ALL applications (stopped, errored...)
- [#1961] Fix kill timeout info log
- [#1987] Fix FreeBSD startup script
- [#2011] Respect process.stdout/.stderr signature
- [#1602] Fix zombie process when using babel-node as interpreter
- [#1283] --skip-env option to not merge update with system env
- Homogeneize actions commands outputs
- Option --interpreter-args added (alias of node-args)
- Allow to use exactly the same option in JSON declaration and CLI (e.g. interpreter) to avoid confusion
- pm2 show, now shows more commands to manage processes
- Refactor programmatic system

## 1.0.2

- [#1035 #1055] Deactivate automatic dump on startup scripts
- [#1980] Add Javascript source map resolution when exceptions occurs [Documentation](http://pm2.keymetrics.io/docs/usage/source-map-support/)
- [#1937] Allow to act on application having numerics as app name
- [#1945] Fix post_update commands section when file contains Javascript
- [#624] --only <app-name> to act only on specified app name in json app declaration
- [0.6.1](https://github.com/keymetrics/pmx/releases/tag/0.6.1) PMX upgrade

## 1.0.1

- [#1895] pm2 id <app_name>: output array of ids for app_name @soyuka
- [#1800] pm2 show <app_name>: now also display node.js version @soyuka

## 1.0.0

- [#1844][#1845][#1850] Load configuration in /etc/default/pm2 + add ulimit -n override
- [#1810] Add --kill-timeout <number> option (delay before process receive a final SIGKILL)
- [#1830] Add tests for PM2_KILL_TIMEOUT (SIGKILL delay) + default SIGINT to any kind of procs
- [#1825] Process management commands (start/restart/stop/delete) can take multiple arguments
- [#1822] Add new method pm2.sendDataToProcessId(type|data|id) to send data to processes
- [#1819] Send SIGINT signal to process instead of SIGTERM
- [#1819][#1794][#1765] Avoid writing on std err/out when process is disconnected

- Add default attribute in schema.json to allow to configure default value when passing a JSON
- JSON and CLI starts are now consistent in terms of option size, attribute number
- pm2.restart(json_data, function(err, data) now returns an array of process instead of simple object (success:true))
- Now pm2 restart process.json --env <X>, refresh environment variable on each restart depending of the X environment
- prepareJSON method in PM2 code (God.js) removed
- partition Common.prepareAppConf (duplicate with verifyConfs)
- Change signature of Common.prepareAppConf
- Centralize Interpreter resolution via Common.sink.resolveInterpreter(app) in Common.js

- Better meta information when process restart/reload/stop (signal + exit code)
- Upgrade pm2-axon, cron, should, mocha, coffee-script, chokidar, semver NPM packages
- Show process configuration option when describing process
- Add --no-automation flag
- Fix when starting application with illegal names (#1764)
- Fix management of app starting with numerics in the filename (#1769)
- Fix versiong system (reset to default on resurrect/prepare)
- Increase buffer size for versioning meta parsing

## 0.15.10

- Hot fix #1746

## 0.15.9

- Chokidar upgraded to 1.2
- Fix startup script via new --hp option
- Fix JSON refresh system

## 0.15.1-8

- JSON refresh available
- New module system backward compatible and compatible with NPM 3.x
- Possibility to install module from tgz (#1713)
- ecosystem generated file via pm2 generate uptaded (not json5 prefix anymore, and updated comments)
- always prefix logs #1695
- blessed dependency removed
- drop locking system
- add callback to deploy (#1673)
- typo fixes
- pm2.update added
- small db for pm2 modules added (solve npm 3.x issue)
- pm2 multiset "k1 v1 k2 v2 k3 v3"
- babel dependency removed
- blessed dependency removed
- chalk, safe-clone-deep, shelljs, semver upgraded
- New command: pm2 module:update <module_name> -> Update a module
- New command: pm2 module:publish  -> Publish module in current folder + Git push
- New command: pm2 module:generate [module name] -> Generate a sample module
- Feature: configuration system for raw Node.js applications
- alias pm2 install with pm2 i
- JSON declaration: You can now use process.env in application declaration file
- watch has been refactored for windows and tests
- allow installation of specific module version
- wrap final process kill intro try catch (c4aecc8)
- Appveyor to test PM2 under Windows added (+ fix some incorect file name)
- Allow to escape key name when using pm2 conf system

## 0.14.7

- New flag `--no-pmx` : starts an app without injecting pmx
- New feature : cron restart now works in fork mode as well
- Disabled auto-gc on interactor
- Allow PM2 to execute binaries in $PATH
- pm2 link priv pub --recyle for elastic infrastructure
- pm2 deploy now check default file ecosystem.js[on|on5], package.json

## 0.14.6

- Scoped PM2 actions
- Password encryption via pm2 set pm2:passwd xxxx
- Interactor Remote action refactor
- .getSync method to get configuration variable synchronously
- Add password protected PM2 methods (install, delete)
- pm2 get|pm2 conf display all confs
- Password protected PM2 flag
- New flag : `--restart-delay <ms>` (or `restart_delay` in JSON declaration)
- New command : `pm2 deepUpdate`
- New command (beta) : `pm2 logrotate`
- Enhancement : pm2 handles processes that can't be killed in a better way
- Fix : some ignore_watch issues
- Fix : some pm2 startup systemd issues

## 0.14.5

- Hot fix

## 0.14.4

- New command : `pm2 iprobe [app_name|app_id|'ALL']`
- Feature: FreeBSD startup script
- Fix: Remove forced GC
- Fix: ##1444 --next-gen-js in fork mode
- Fix: Windows path fix

## 0.14.3 (Current Stable)

- `pm2 flush` now flushes pm2.log as well
- New flag : `--no-treekill` : when used PM2 won't kill children processes
- New flags : `pm2 logs ['all'|'PM2'|app_name|app_id] [--err|--out] [--lines <n>] [--raw] [--timestamp [format]]`
- Enhancement: Modules installable via Github: `pm2 install username/repository`
- Feature: PMX has *scoped function* -> pm2 stores temporary output from custom functions
- Fix: Interactor issue when doing an heapdump
- Feature: PM2 CLI autocompletion

## 0.14.2

- Improved pm2-dev
- Now when apps list is empty, the `id` counter is set to 0
- Removed pres/keymetrics.js post-install script
- Fix : `pm2 logs` allocation error
- Fix : `pm2 prettylist|jlist` truncated output

## 0.14.0 - CrystalClear (pre 1.0)

- Removed: pm2.startJSON() method, now call pm2.start()
- API Change: pm2 start <app_name|app_id> restart an application already launched
- API Change: pm2 start <json> restart all json apps if already launched
- pm2 start all - restart all applications
- pm2 reload <json_file> possible
- pm2 gracefulReload <json_file> possible
- Smart start (pm2 start app.js ; pm2 stop app ; pm2 start app)
- Reduced memory footprint
- Reduced pipelined data
- Reduced CPU usage
- Faster command processing
- Upgrade shelljs, semver, colors, chalk, coffee-script, async, json-stringify-safe, cron, debug, commander
- Fix: launchBus() only connects and disconnects once

- Refactored `pm2 logs` :
  - Now you don't need to install tail on Windows
  - You don't need to Ctrl^C and `pm2 logs` again when a new app is launched (this one will be detected and added to the real-time logs output)
  - Logs are shown in chronological order at a file level (modified date)
  - More verbosity : tailed logs are explicitely separated from the real-time logs
  - Real-time logs now use the `bus` event emitter
  - PM2 logs added to the `bus`
  - `--lines <n>` and `--raw` flags available for `pm2 logs` command
  - New flag : '--timestamp [format]' // default format is 'YYYY-MM-DD-HH:mm:ss'
  - Now you can exclusively show PM2 logs by doing `pm2 logs PM2`

## 0.12.16

- Feature : File transmission added in Agent
- Feature : Transmit Node.js/io.js version in Agent
- Feature : Parameters can be passed to remote actions
- Feature : Support JS in addition to JSON and JSON5 config files #1298
- Enhanced: pm2 conf display all configuration values
- Enhanced: pm2-dev
- Enhanced: Better error messages when validating data passed via CLI
- Enhanced: Smaller memory footprint for PM2 (~30%)
- Fix #1285 : PID file was deleted after a reload/gracefulReload
- Fix : ENOMEM made PM2 crash

## 0.12.15

- Fix #941 : Env variables overrided when an app is restarted
- max_memory_restart now performs a graceful reload
- `pm2 logs --raw` now shows 20 last lines of each log file
- pm2-dev run app.js : start an app in dev mode (--no-daemon --watch and stream logs of all launched apps)
- --no-daemon command now display logs of all processes (Docker)

## 0.12.14

- `ilogs` is no longer part of PM2
- Improved interaction with Keymetrics
- BabelJS is now integrated into PM2 (`--next-gen-js` flag)

## 0.12.13

- Enhanced  : PM2 doesn't leave processes behind when it crashes
- Enhanced  : Call reload instead of restart when max-memory-limit reached
- Enhanced  : Modules are compatible ES6 by default by adding --harmony flag
- Enhanced  : Dump feature is now smarter
- Fix #1206 : fix `pm2 logs` bug when merged_logs
- Fix       : pm2 scale doesn't try to scale a fork_mode process

## 0.12.12

- `pm2 logs --raw` flag : show logs in raw format
- New command: pm2 scale <app_name> <number> - scale up/down an application
- Fix #1177 : no concurrent vizion.parse() for the same process event when it restarts
- Added: Expose kill method programmatically
- Added: Call disconnect without a function
- Added: Programmatic call to .connect can now take no-daemon-option
- Fixed: starting a JSON programmatically return a process list coming from God
- Fixed: Reflect dump functions from CLI and God
- Enhanced: New CLI API for configuring modules (pm2 conf module.option [value])
- Added: Using Keymetrics harden PM2 by enabling a WatchDog that auto restart PM2 in case of crash
- Added: Expose pm2 gc programmatically
- Added: pm2 install <module_name> update the module
- Enhanced: 4 new test suits for PM2 programmatics call
- Enhanced: Documentation restructured

## 0.12.11

- `--no-autorestart` flag : starts an app without automatic restart feature
(`"autorestart" : false` in JSON declaration)

- `--no-vizion` flag : starts an app completely without vizion features
(`"vizion" : false` in JSON declaration)

- Fix #1146 : add module._initPaths() on ProcessContainer.js so it forces each
new process to take the current NODE_PATH env value in account

- New: pm2.start() now handles json objects as param

- Added: timestamps to KM agent logs

- Fix: now properly closes all fds after logging has finished.

- New command: pm2 gc (manually triggers garbage collection for PM2)

- VersioningManagment: exec() timeout configurable via .json

- Fix #1143 :
If we start let's say 4 instances of an app (cluster_mode),
Each app will have a value in process.env.NODE_APP_INSTANCE which will be 0 for the first one,
1, 2 and 3 for the next ones.

- Fix #1154 :
Negative arguments to '-i' are substracted to CPU cores number.
E.g: 'pm2 start app.js -i -3' in a 8 cpus environment will start 5 instances (8 - 3).

## 0.12.10

- Fix : PM2 interactor doesn't send data about dead processes ('_old_') anymore.
- Fix #1137 : Safe params for 'pm2 list' so cli-table won't fail
- Refactored reverse interaction with keymetrics for better stability and more verbosity on Rollback/Pull/Upgrade operations

## 0.12.9

- Fix #1124 : PM2_PROGRAMMATIC flag wasn't handled properly
- Fix #1121 : NODE_PATH before PATH so custom node versions come first
- Fix #1119 : Safe params so cli-table won't fail
- Fix #1099 : Bug when app name starts by digit (e.g '1-myApp')
- Fix #1111 : More verbosity on writeFileSync errors
- New env setting: PM2_KILL_TIMEOUT (ms) : time to wait before a process is considered dead
- New env setting: PM2_CONCURRENT_ACTIONS : use it with care, value bigger than 1 is considered unstable
- Refactored reload/gracefulReload for better stability

## 0.12.8

- Fix : `Channel closed error`
- Fix : `Resource leak error`
- Fix#1091 : when passing a wrong formated number to `-i` infinite loop
- Fix #1068 #1096 : restart fails after reloadLogs()
- New : When PM2 is being killed, all restarts are blocked to avoid conflict
- New : PM2 dumps the process list before exiting if it is killed by signal
- Refactored stop/restart for better stability

## 0.12.7

- pm2 logs : Now shows merged logs
- Fix #929 #1043 : Bug pm2 stop/restart not working properly
- Fix #1039 : Better algorithm for vision recursive parsing to avoid infinite loops
- Automatize #858 #905: Directly init pm2 folder if not present when using it programmatically
- Add Bus system from PM2 programmatic API

## 0.12.6

- Enhancement of startJson command (force_name and additional_env options)
- Fix #990 : pm2 flush while pm2 logs was open bug
- Fix #1002 : pm2 monit bug
- Fix #1024 : enhancement
- Fix #1011 : json-stringify-safe bug
- Fix #1007 ##1028 #1013 #1009 : pm2 desc bug
- Fix : pm2 interact delete when file doesn't exist bug

## 0.12.5

- Windows support

## 0.12.4

- Never start a process that already has a PID [#938]
- 1. Make platform auto detecting. 2. Support darwin startup script. [#936]
- Fix #857 #935, add scriptArgs back [d61d710]
- Fix broken link upstart [f8ff296]
- Fixed: multiple calls to vizion.parse() for the same process [0e798b1]
- fix 2015 test easter egg - Happy New Year! [85d11d5]
- fixes #906 [#911]
- Add back automatic coffee interpreter #488 #901 [e9a69fe]
- Upgrade cli-table, commander, colors, moment dependencies [0cc58ce][a4b7d8d]
- Domain system to patch fix the exception thrown by the cluster module
- Fix #830 #249 #954 when there is no HOME env to default to /etc/.pm2 [17d022c]

## 0.12.3

- fixed critical bug: `process.env` flattens all env-vars [#898]
- npm maintainers format [#894]
- fix `pm2 desc` crash bug [#892]
- fix CLI typo [#888]
- `port` config [#885]

## 0.12.2

- treeKill copyright and update [#848] [#849]
- Allow environment variables per each ecosystem deploy [#847]
- max-memory-restart option [#697] [#141]
- JSON validation (cf ADVANCED_README.md) [#768] [#838]
- CLI/JSON refactoring
- watch fixes
- execute binary softwares
- node_args refactored (ESC support) [#838]
- reload env graceful and peaceful [#838]
- min_uptime added [#838]
- startOrRestart conf.json does update environment variables [#805]
- vizion only refresh ahead and unstaged flags [f1f829c]
- worker restart cluster process if it's equal to 0 && online [c2e3581]
- pm2 pull <name> [commit_id] [c2e3581] [4021902]
- fix reloadLogs for fork mode [c0143cc][197781e]
- waterfall logs stream [#822]
- --log option to have a merged error and out output [#822]
- God core refactors
- test refactoring
- update isBinaryFile [636fd99]
- pid deletion has been resurected [f2ce631]
- worker refactor [29fc72b]
- fix no color [3feead2]
- upgrade chokidar 0.12 with follow symlink [4ac0e74]
- refactor Reload [cf94517][f1eb17]
- avoid truncate with pm2 logs command [26aff8b]
- God print log with timestamp via PM2_LOG_DATE_FORMAT [bf2bf8a][3eaed07]
- better test suit
- new treekill system [11fe5f4]

Big thanks to @Tjatse !

## 0.12.1

- Harden Lock system
- Fix Worker bug / Refactor Worker
- Cleanly close interactor sockets on end
- Add backward compatibility for older PM2 on kill action via system signal SIGQUIT
- once listener for killDaemon

## 0.12.0 - clear water ops

- better ecosystem.json5 file with embedded comments
- startOrRestart conf.json update environment variables #805 #812
- pm2 start my/bin/file work out of the box
- JSON5 support
- PM2_HOME supported - PM2 files paths relocation (logs, pid) via PM2_HOME option
- post_updates commands are searched in process.json/ecosystem.json/package.json
- Worker system to verify up to date repositories
- Rename process running with PM2 <version> - app_name
- Process Lock system
- Inner iteraction with PM2 possible #782
- Better vizion system
- backward / forward / pull command
- Doc moved to doc
- remove uidnumber module
- pre install / post install scripts removed
- Remote Lock System
- More God tests
- GRACEFUL_LISTEN_TIMEOUT constant configurable
- Logs are closed in Fork mode when reloading
- Fix not tty
- Fix cluster structure nullification
- Pre Windows Support
- Send revision process on each process event
- Upgrade Commander (better help display)
- Upgrade chokidar to 0.10.x
- Better interactor
- Better revision parsing
- Configuration file
- Close fd in fork mode while reloading
- Remove --run-as-user option
- Better CLI interface for interactor
- axm:monitor axm:dynamic
- Temporaly merge pm2-interface with pm2
- Cache cpu infos
- Make revision transit in God.bus broadcast
- Ignore useless events in God.bus broadcast

## 0.11.0-1

- Multi user support and privilege containment: UNIX sockets instead of TCP
- Reload refactoring
- Process on uncaughtexcption to flush process list
- pm2 logs display state change of processes

## 0.10.x

- multi host for pm2 deploy
- fork mode by default
- fix watch on clusters
- refactor watch
- env option via programmatic interface
- fix watch system
- correct pm2 describe command
- close file used via pm2 flush
- add startOrReload
- better closing events

## 0.10.0 - PM2 Hellfire release

- PM2 hearth code has been refactored and now it handles extreme scenario without any leak or bug
- PM2 restart <json|id|name|all> refresh current environment variables #528
- PM2 delete all more verbose
- PM2 reset <all|id|name> reset restart numbers
- Auto update script at PM2 installation
- --watch enhanced to avoid zombie processes
- Restart app when reaching a limit of memory by using --max-memory-restart (and max_memory_restart via JSON)(https://github.com/Unitech/pm2#max-memory-restart)
- PM2 respects strong unix standard process management
- Remove timestamps by default with pm2 logs
- Coffeescript not enabled by default anymore (enhance memory usage)
- PM2 Programmatic interface enhanced
- PM2 hearth refactor
- PM2 describe show node-args
- node_args for V8 options is now available via JSON declaration
- Watch system avoid ghost processes
- Memory leak fixes
- Better performance on interface
- Fix tests
- Enable PM2_NODE_OPTIONS and node-args for fork mode
- Dependencies updated
- Faster monitoring system
- AXM actions unification
- Socket errors handled
- Watchdog via Agent - restart automatically PM2 with previous processes in case of crash
- PM2_NODE_OPTIONS deprecation (use --node-args instead)

## 0.9.6 - 0.9.5 - 0.9.4

- Bash test auto exit when failure
- Bump fix log streaming
- Bump fix to display old logs streaming by default
- Bump fix

## 0.9.3

- Critical bug on fork mode fixed (stream close)
- Advanced log display interface pm2-logs #589
- Simple log timestamp via --log-date-format (with momentJS formating) #183
- Possible to pass arguments via scriptArg with programmatic PM2 #591
- Gentoo startup script generation #592
- Fix run-as-user and run-as-group in fork mode #582
- Documentation update

## 0.9.2

- max_restart enabled
- sudo fix for init scripts
- some startup refactoring
- Possibility to specify the configuration folder for PM2 via process.env.PM2_HOME
- Fix date format
- N/A for undefined date
- Evented interactions with PM2, available via pm2-interface
- Deep Interactor refactoring
- Force reload for upstart script

## 0.9.0-0.9.1

- CLI flattening
- require('pm2') possible to interact with
- deployment system
- Remove builtin monitoring feature
- Fix watch on delete #514
- Gracefull reload now rightly handled #502
- Allow path in watch option #501
- Allow management of non-interpreted binaries #499
- Documentation fixes

## 0.8.12-0.8.15

- Version bumping

## 0.8.12

- Fix CWD option #295

## 0.8.10-0.8.11

- Builtin monitoring feature with email (with pm2 subscribe)
- Reload Logs for Fork
- Deletion of possible circular dependencies error
- pm2 updatePM2 command to update in-memory pm2
- notification message if the in-memory pm2 is outdated
- cwd option in json #405 #417 #295
- README updates
- ipc channel for fork mode
- re enable process event loggin for interactor
- avoid possible stream error
- watch ignore option in JSON

## 0.8.5-6

- Update monitoring module

## 0.8.4

- Remove C++ binding for monitoring
- Update axon and axon-rpc

## 0.8.2

- Adds option to switch to a different user/group before starting a managed process #329
- watch doesnt watch node_module folder
- default log files and pid files location can be overrided by PM2_LOG_DIR / PM2_PID_DIR


## 0.8.1

- Readme changes #400 #398
- Fix describe command #403
- reload/gracefulReload throw error if no process has been reloaded #340

## 0.8.0

- More verbosity to pm2.log
- Fast Watch & Reload
- New README.md
- --merge-logs option to merge logs for a group of process
- logs reload with SIGUSR2 or `pm2 reloadLogs`
- return failure code when no process has been reloaded
- Upgrade of outdated packages
- Silent (-s) flag remove all possible pm2 output to CLI
- New display for list, more compact
- `pm2 describe <id>` to get more details about a process
- Fixed 0.10.x issue when stop/kill
- Helper shown when -h
- Linter errors
- Systemd support for Fedora / ArchLinux
- #381 Add support for Amazon Linux startup script
- Fixed rendering
- Interaction possible with VitalSigns.io
- Avoid exception when dump file is not present

## 0.7.8

- List processes with user right `service pm2-init.sh status`

## 0.7.7

- Bug fixes, stability fixes

## 0.7.2

- harmony can be enabled [Enabling harmony](#a66)
- can pass any options to node via PM2_NODE_OPTIONS, configurable via ~/.pm2/custom_options.sh
- pid file written in ~/.pm2/pm2.pid
- startup script support for CentOS
- --no-daemon option (Alex Kocharin)
- json file now can be : started/stoped/restarted/deleted
- coffeescript support for new versions (Hao-kang Den)
- accept JSON via pipe from standard input (Ville Walveranta)
- adjusting logical when process got an uncaughtException (Ethanz)

### Update from 0.x -> 0.7.2

- CentOS crontab option should not be used anymore and use the new init script with `pm2 startup centos`
- If you use the configuration file or the harmonoy option, you should regenerate the init script

## 0.7.1

- Integrates hardened reload, graceful reload and strengthened process management

## 0.7.0

- Reload works at 100%
- Logs are now separated by process id
- Minimal listing with -m option
- pid files are deleted once process exit
- ping method to launch or knwo if pm2 is alive
- more tests
- coffeescript is supported in cluster mode
- clean exit
- clean process stopping
- speed process management enhanced
- async used instead of recuresive loops
- broad test for node 0.11.10 0.11.9 0.11.8 0.11.7 0.11.5 0.10.24 0.10.23 0.10.22 0.10.21 0.10.20 0.10.19 0.10.18 0.10.17 0.10.16 0.10.15 0.10.14 0.10.13 0.10.12 0.10.11 0.8

## 0.6.8

- Homogeneize JSON #186
- Auto intepreter selection (you can do pm2 start app.php)

## 0.5.6

- Coffeescript support
- Updating dependencies - axon - commander
- Log feature enhanced - duplicates removed - name or id can be passed to pm2 logs xxx

## 0.5.5

- Ability to set a name to a launched script + tests
    - with the --name option when launching file
    - with the "name" parameter for JSON files
- Ability to restart a script by name + tests
- Upgrade node-usage to 0.3.8 - fix monitoring feedback for MacOSx
- require.main now require the right file (activate it by modifying MODIFY_REQUIRE in constants.js)
- CentOS startup script with pm2 startup centos
- 0 downtime reload

## 0.5.4

- Remove unused variable in startup script
- Add options min_uptime max_restarts when configuring an app with JSON
- Remove pid file on process exit
- Command stopAll -> stop all | restartAll -> restart all (backward compatible with older versions)

## 0.5.0

- Hardening tests
- Cron mode to restart a script
- Arguments fully supported
- MacOSx monitoring possible


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

## Cloning PM2 development

```bash
$ git clone https://github.com/Unitech/pm2.git
$ cd pm2
$ git checkout development
$ npm install
```

I recommend having a pm2 alias pointing to the development version to make it easier to use pm2 development:

```
$ cd pm2/
$ echo "alias pm2='`pwd`/bin/pm2'" >> ~/.bashrc
```

You are now able to use pm2 in dev mode:

```
$ pm2 update
$ pm2 ls
```

## Project structure

```
.
├── bin      // pm2, pmd, pm2-dev, pm2-docker are there
├── examples // examples files
├── lib      // source files
├── pres     // presentation files
├── test     // test files
└── types    // TypeScript definition files
```

## Modifying the Daemon

When you modify the Daemon (lib/Daemon.js, lib/God.js, lib/God/*, lib/Watcher.js), you must restart the pm2 Daemon by doing:

```
$ pm2 update
```

## Commit rules

### Commit message

A good commit message should describe what changed and why.

It should :
  * contain a short description of the change (preferably 50 characters or less)
  * be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names
  * be prefixed with one of the following word
    * fix : bug fix
    * hotfix : urgent bug fix
    * feat : new or updated feature
    * docs : documentation updates
    * BREAKING : if commit is a breaking change
    * refactor : code refactoring (no functional change)
    * perf : performance improvement
    * style : UX and display updates
    * test : tests and CI updates
    * chore : updates on build, tools, configuration ...
    * Merge branch : when merging branch
    * Merge pull request : when merging PR

## Tests

There are two tests type. Programmatic and Behavioral.
The main test command is `npm test`

### Programmatic

Programmatic tests are runned by doing

```
$ bash test/pm2_programmatic_tests.sh
```

This test files are located in test/programmatic/*

### Behavioral

Behavioral tests are runned by doing:

```
$ bash test/e2e.sh
```

This test files are located in test/e2e/*

## File of interest

- `$HOME/.pm2` contain all PM2 related files
- `$HOME/.pm2/logs` contain all applications logs
- `$HOME/.pm2/pids` contain all applications pids
- `$HOME/.pm2/pm2.log` PM2 logs
- `$HOME/.pm2/pm2.pid` PM2 pid
- `$HOME/.pm2/rpc.sock` Socket file for remote commands
- `$HOME/.pm2/pub.sock` Socket file for publishable events

## Generate changelog

### requirements

```
npm install git-changelog -g
```

### usage

Edit .changelogrc
Change "version_name" to the next version to release (example 1.1.2).
Change "tag" to the latest existing tag (example 1.1.1).

Run the following command into pm2 directory
```
git-changelog
```

It will generate currentTagChangelog.md file.
Just copy/paste the result into changelog.md


================================================
FILE: GNU-AGPL-3.0.txt
================================================

                    GNU AFFERO GENERAL PUBLIC LICENSE
                       Version 3, 19 November 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.

  A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate.  Many developers of free software are heartened and
encouraged by the resulting cooperation.  However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.

  The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community.  It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server.  Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.

  An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals.  This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU Affero General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Remote Network Interaction; Use with the GNU General Public License.

  Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software.  This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time.  Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    PM2 Process manager for Node.JS
    Copyright (C) 2013-2016 Strzelewicz Alexandre

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source.  For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code.  There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.


--- ALEXANDRE STRZELEWICZ


================================================
FILE: LICENSE
================================================
GNU-AGPL-3.0.txt


================================================
FILE: README.md
================================================
<div align="center">
 <br/>

![https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-logo-2.png](https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-logo-2.png)

<b>P</b>(rocess) <b>M</b>(anager) <b>2</b><br/>
  <i>Runtime Edition</i>
<br/><br/>


<a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
  <img src="https://img.shields.io/npm/dm/pm2" alt="Downloads per Month"/>
</a>

<a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
  <img src="https://img.shields.io/npm/dy/pm2" alt="Downloads per Year"/>
</a>

<a href="https://badge.fury.io/js/pm2" title="NPM Version Badge">
   <img src="https://badge.fury.io/js/pm2.svg" alt="npm version">
</a>

<br/>
<br/>
<br/>
</div>


PM2 is a production process manager for Node.js/Bun applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.

Starting an application in production mode is as easy as:

```bash
$ pm2 start app.js
```

PM2 is constantly assailed by [more than 1800 tests](https://github.com/Unitech/pm2/actions/workflows/node.js.yml).

Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/)

Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 12.X and Bun since v1


## Installing PM2

### With NPM

```bash
$ npm install pm2 -g
```

### With Bun

```bash
$ bun install pm2 -g
```
**Please note that you might need to symlink node to bun if you only want to use bun via `sudo ln -s /home/$USER/.bun/bin/bun /usr/bin/node`**

___

You can install Node.js easily with [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) or [FNM](https://github.com/Schniz/fnm) or install Bun with `curl -fsSL https://bun.sh/install | bash`

### Start an application

You can start any application (Node.js, Bun, and also Python, Ruby, binaries in $PATH...) like that:

```bash
$ pm2 start app.js
```

Your app is now daemonized, monitored and kept alive forever.

### Managing Applications

Once applications are started you can manage them easily:

![Process listing](https://github.com/Unitech/pm2/raw/master/pres/pm2-ls-v2.png)

To list all running applications:

```bash
$ pm2 list
```

Managing apps is straightforward:

```bash
$ pm2 stop     <app_name|namespace|id|'all'|json_conf>
$ pm2 restart  <app_name|namespace|id|'all'|json_conf>
$ pm2 delete   <app_name|namespace|id|'all'|json_conf>
```

To have more details on a specific application:

```bash
$ pm2 describe <id|app_name>
```

To monitor logs, custom metrics, application information:

```bash
$ pm2 monit
```

[More about Process Management](https://pm2.keymetrics.io/docs/usage/process-management/)

### Cluster Mode: Node.js Load Balancing & Zero Downtime Reload

The Cluster mode is a special mode when starting a Node.js application, it starts multiple processes and load-balance HTTP/TCP/UDP queries between them. This increase overall performance (by a factor of x10 on 16 cores machines) and reliability (faster socket re-balancing in case of unhandled errors).

![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/cluster.png)

Starting a Node.js application in cluster mode that will leverage all CPUs available:

```bash
$ pm2 start api.js -i <processes>
```

`<processes>` can be `'max'`, `-1` (all cpu minus 1) or a specified number of instances to start.

**Zero Downtime Reload**

Hot Reload allows to update an application without any downtime:

```bash
$ pm2 reload all
```

[More informations about how PM2 make clustering easy](https://pm2.keymetrics.io/docs/usage/cluster-mode/)

### Container Support

With the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a hardened production environment.
Using it is seamless:

```
RUN npm install pm2 -g
CMD [ "pm2-runtime", "npm", "--", "start" ]
```

[Read More about the dedicated integration](https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)

### Host monitoring speedbar

PM2 allows to monitor your host/server vitals with a monitoring speedbar.

To enable host monitoring:

```bash
$ pm2 set pm2:sysmonit true
$ pm2 update
```

![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/vitals.png)

### Terminal Based Monitoring

![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)

Monitor all processes launched straight from the command line:

```bash
$ pm2 monit
```

### Log Management

To consult logs just type the command:

```bash
$ pm2 logs
```

Standard, Raw, JSON and formated output are available.

Examples:

```bash
$ pm2 logs APP-NAME       # Display APP-NAME logs
$ pm2 logs --json         # JSON output
$ pm2 logs --format       # Formated output

$ pm2 flush               # Flush all logs
$ pm2 reloadLogs          # Reload all logs
```

To enable log rotation install the following module

```bash
$ pm2 install pm2-logrotate
```

[More about log management](https://pm2.keymetrics.io/docs/usage/log-management/)

### Startup Scripts Generation

PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart.

Init Systems Supported: **systemd**, **upstart**, **launchd**, **rc.d**

```bash
# Generate Startup Script
$ pm2 startup

# Freeze your process list across server restart
$ pm2 save

# Remove Startup Script
$ pm2 unstartup
```

[More about Startup Scripts Generation](https://pm2.keymetrics.io/docs/usage/startup/)

### Updating PM2

```bash
# Install latest PM2 version
$ npm install pm2@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2 update
```

*PM2 updates are seamless*

## PM2+ Monitoring

If you manage your apps with PM2, PM2+ makes it easy to monitor and manage apps across servers.

![https://app.pm2.io/](https://pm2.io/img/app-overview.png)

Feel free to try it:

[Discover the monitoring dashboard for PM2](https://app.pm2.io/)

Thanks in advance and we hope that you like PM2!

## CHANGELOG

[CHANGELOG](https://github.com/Unitech/PM2/blob/master/CHANGELOG.md)

## Contributors

[Contributors](http://pm2.keymetrics.io/hall-of-fame/)

## License

PM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0).
For other licenses [contact us](mailto:contact@keymetrics.io).


================================================
FILE: bin/pm2
================================================
#!/usr/bin/env node

require('../lib/binaries/CLI.js');


================================================
FILE: bin/pm2-dev
================================================
#!/usr/bin/env node

require('../lib/binaries/DevCLI.js');


================================================
FILE: bin/pm2-docker
================================================
#!/usr/bin/env node

require('../lib/binaries/Runtime4Docker.js');


================================================
FILE: bin/pm2-runtime
================================================
#!/usr/bin/env node

require('../lib/binaries/Runtime4Docker.js');


================================================
FILE: bin/pm2-windows
================================================
#!/usr/bin/env node

require('../lib/binaries/CLI.js');


================================================
FILE: bin/pm2.ps1
================================================
# pm2.ps1
$pm2Path = Join-Path $PSScriptRoot "../lib/binaries/CLI.js"
node $pm2Path $args


================================================
FILE: constants.js
================================================
/**
 * Copyright 2013-2022 the PM2 project authors. All rights reserved.
 * Use of this source code is governed by a license that
 * can be found in the LICENSE file.
 */

var debug  = require('debug')('pm2:conf');
var p      = require('path');
var util   = require('util');
var chalk  = require('ansis');

/**
 * Get PM2 path structure
 */
var path_structure = require('./paths.js')(process.env.OVER_HOME);

/**
 * Constants variables used by PM2
 */
var csts = {
  PREFIX_MSG              : chalk.green('[PM2] '),
  PREFIX_MSG_INFO         : chalk.cyan('[PM2][INFO] '),
  PREFIX_MSG_ERR          : chalk.red('[PM2][ERROR] '),
  PREFIX_MSG_MOD          : chalk.bold.green('[PM2][Module] '),
  PREFIX_MSG_MOD_ERR      : chalk.red('[PM2][Module][ERROR] '),
  PREFIX_MSG_WARNING      : chalk.yellow('[PM2][WARN] '),
  PREFIX_MSG_SUCCESS      : chalk.cyan('[PM2] '),

  PM2_IO_MSG : chalk.cyan('[PM2 I/O]'),
  PM2_IO_MSG_ERR : chalk.red('[PM2 I/O]'),

  TEMPLATE_FOLDER         : p.join(__dirname, 'lib/templates'),

  APP_CONF_DEFAULT_FILE   : 'ecosystem.config.js',
  APP_CONF_TPL            : 'ecosystem.tpl',
  APP_CONF_TPL_SIMPLE     : 'ecosystem-simple.tpl',
  SAMPLE_CONF_FILE        : 'sample-conf.js',
  LOGROTATE_SCRIPT        : 'logrotate.d/pm2',

  DOCKERFILE_NODEJS       : 'Dockerfiles/Dockerfile-nodejs.tpl',
  DOCKERFILE_JAVA         : 'Dockerfiles/Dockerfile-java.tpl',
  DOCKERFILE_RUBY         : 'Dockerfiles/Dockerfile-ruby.tpl',

  SUCCESS_EXIT            : 0,
  ERROR_EXIT              : 1,
  CODE_UNCAUGHTEXCEPTION  : 1,

  IS_BUN                  : typeof Bun !== 'undefined',
  IS_WINDOWS              : (process.platform === 'win32' || process.platform === 'win64' || /^(msys|cygwin)$/.test(process.env.OSTYPE)),
  ONLINE_STATUS           : 'online',
  STOPPED_STATUS          : 'stopped',
  STOPPING_STATUS         : 'stopping',
  WAITING_RESTART         : 'waiting restart',
  LAUNCHING_STATUS        : 'launching',
  ERRORED_STATUS          : 'errored',
  ONE_LAUNCH_STATUS       : 'one-launch-status',

  CLUSTER_MODE_ID         : 'cluster_mode',
  FORK_MODE_ID            : 'fork_mode',

  ENABLE_GIT_PARSING      : false,
  LOW_MEMORY_ENVIRONMENT  : process.env.PM2_OPTIMIZE_MEMORY || false,

  MACHINE_NAME            : process.env.INSTANCE_NAME || process.env.MACHINE_NAME || process.env.PM2_MACHINE_NAME,
  SECRET_KEY              : process.env.KEYMETRICS_SECRET || process.env.PM2_SECRET_KEY || process.env.SECRET_KEY,
  PUBLIC_KEY              : process.env.KEYMETRICS_PUBLIC || process.env.PM2_PUBLIC_KEY || process.env.PUBLIC_KEY,
  KEYMETRICS_ROOT_URL     : process.env.KEYMETRICS_NODE || process.env.PM2_APM_ADDRESS || process.env.ROOT_URL || process.env.INFO_NODE || 'root.keymetrics.io',


  PM2_BANNER       : '../lib/motd',
  PM2_UPDATE       : '../lib/API/pm2-plus/pres/motd.update',
  DEFAULT_MODULE_JSON     : 'package.json',

  MODULE_BASEFOLDER: 'module',
  MODULE_CONF_PREFIX: 'module-db-v2',
  MODULE_CONF_PREFIX_TAR: 'tar-modules',

  EXP_BACKOFF_RESET_TIMER : parseInt(process.env.EXP_BACKOFF_RESET_TIMER) || 30000,
  REMOTE_PORT_TCP         : isNaN(parseInt(process.env.KEYMETRICS_PUSH_PORT)) ? 80 : parseInt(process.env.KEYMETRICS_PUSH_PORT),
  REMOTE_PORT             : 41624,
  REMOTE_HOST             : 's1.keymetrics.io',
  SEND_INTERVAL           : 1000,
  RELOAD_LOCK_TIMEOUT     : parseInt(process.env.PM2_RELOAD_LOCK_TIMEOUT) || 30000,
  GRACEFUL_TIMEOUT        : parseInt(process.env.PM2_GRACEFUL_TIMEOUT) || 8000,
  GRACEFUL_LISTEN_TIMEOUT : parseInt(process.env.PM2_GRACEFUL_LISTEN_TIMEOUT) || 3000,
  LOGS_BUFFER_SIZE        : 8,
  CONTEXT_ON_ERROR        : 2,
  AGGREGATION_DURATION    : process.env.PM2_DEBUG || process.env.NODE_ENV === 'local_test' || process.env.NODE_ENV === 'development' ? 3000 : 5 * 60000,
  TRACE_FLUSH_INTERVAL    : process.env.PM2_DEBUG || process.env.NODE_ENV === 'local_test' ? 1000 : 60000,

  // Concurrent actions when doing start/restart/reload
  CONCURRENT_ACTIONS      : (function() {
    var concurrent_actions = parseInt(process.env.PM2_CONCURRENT_ACTIONS) || 2;
    debug('Using %d parallelism (CONCURRENT_ACTIONS)', concurrent_actions);
    return concurrent_actions;
  })(),

  DEBUG                   : process.env.PM2_DEBUG || false,
  WEB_IPADDR              : process.env.PM2_API_IPADDR || '0.0.0.0',
  WEB_PORT                : parseInt(process.env.PM2_API_PORT)  || 9615,
  WEB_STRIP_ENV_VARS      : process.env.PM2_WEB_STRIP_ENV_VARS || false,
  MODIFY_REQUIRE          : process.env.PM2_MODIFY_REQUIRE || false,

  WORKER_INTERVAL         : process.env.PM2_WORKER_INTERVAL || 30000,
  KILL_TIMEOUT            : process.env.PM2_KILL_TIMEOUT || 1600,
  KILL_SIGNAL             : process.env.PM2_KILL_SIGNAL || 'SIGINT',
  KILL_USE_MESSAGE        : process.env.PM2_KILL_USE_MESSAGE || false,

  PM2_PROGRAMMATIC        : typeof(process.env.pm_id) !== 'undefined' || process.env.PM2_PROGRAMMATIC,
  PM2_LOG_DATE_FORMAT     : process.env.PM2_LOG_DATE_FORMAT !== undefined ? process.env.PM2_LOG_DATE_FORMAT : 'YYYY-MM-DDTHH:mm:ss'

};

module.exports = Object.assign(csts, path_structure);


================================================
FILE: examples/api-pm2/README.md
================================================

# PM2 API

Here is an example of the PM2 API:

```
$ node api.js
```

Will delete all apps, will start http.js, and restart http

Then you will see that the listing shows http app, restarted one time:

```
$ pm2 list
┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬─────────┬──────────┐
│ App name │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem       │ user    │ watching │
├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼─────────┼──────────┤
│ http     │ 0  │ fork │ 7668 │ online │ 1       │ 2s     │ 0%  │ 34.2 MB   │ unitech │ disabled │
└──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴─────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
```


================================================
FILE: examples/api-pm2/api.js
================================================


var pm2 = require('../..');

pm2.delete('all', function(err) {
  if (err) {
    console.error(err);
    return pm2.disconnect();
  }

  pm2.start('http.js', function(err, app) {
    if (err) {
      console.error(err);
      return pm2.disconnect();
    }

    console.log('Process HTTP has been started');

    pm2.restart('http', function(err, app) {
      if (err) {
        console.error(err);
        return pm2.disconnect();
      }

      console.log('Process Restarted');
      return pm2.disconnect();
    });
  });
});


================================================
FILE: examples/api-pm2/http.js
================================================

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(process.env.PORT || 8000, function() {
  console.log('App listening on port %d', server.address().port);
});


================================================
FILE: examples/c-compile/hello.c
================================================
#include <stdio.h>
int main()
{
  // printf() displays the string inside quotation
  printf("Hello, Wss   asdsad!\n");
  return 0;
}


================================================
FILE: examples/cluster-http/README.md
================================================

To start http application in cluster mode:

```bash
$ pm2 start ecosystem.config.js
# OR
$ pm2 start http.js -i max
```


================================================
FILE: examples/cluster-http/ecosystem.config.js
================================================
module.exports = {
  apps : [{
    name   : 'clustered_http',
    script : './http.js',
    instances : 'max',
    exec_mode : 'cluster',
    env : {
      PORT : 8002
    }
  }, {
    name : 'forked_app',
    script : './http.js',
    env : {
      PORT : 8001
    }
  }]
}


================================================
FILE: examples/cluster-http/http-no-exit.js
================================================

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(process.env.PORT || 8089, '0.0.0.0', function() {
  console.log('App listening on port %d', server.address().port);
});

process.on('SIGINT', () => {
})


================================================
FILE: examples/cluster-http/http.js
================================================

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  console.log(`New query`)
  res.end('hey');
}).listen(process.env.PORT || 8089, '0.0.0.0', function() {
  console.log('App listening on port 8089');
});


================================================
FILE: examples/cluster-tcp/README.md
================================================

To start tcp application in cluster mode:

```bash
$ pm2 start ecosystem.config.js
# OR
$ pm2 start tcp.js -i max
```


================================================
FILE: examples/cluster-tcp/http.js
================================================

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(process.env.PORT || 8000, function() {
  console.log('App listening on port %d', server.address().port);
});


================================================
FILE: examples/cluster-tcp/process.config.js
================================================
module.exports = {
  apps : [{
    name   : 'clustered_tcp',
    script : './tcp.js',
    instances : 'max',
    exec_mode : 'cluster',
    env : {
      PORT : 8002
    }
  }, {
    name : 'forked_tcp',
    script : './tcp.js',
    env : {
      PORT : 8001
    }
  }]
}


================================================
FILE: examples/cluster-tcp/tcp.js
================================================
var net = require('net');

var server = net.createServer(function (socket) {
  socket.write('Welcome to the Telnet server of the process' + (process.env.NODE_APP_INSTANCE || 'must be run on pm2'));
}).listen(process.env.PORT || 8888, function() {
  console.log('Listening on port %s', server.address().port);
});


================================================
FILE: examples/custom-nodejs-version/ecosystem.config.js
================================================
module.exports = {
  /**
   * Application configuration section
   * http://pm2.keymetrics.io/docs/usage/application-declaration/
   */
  apps : [
    // First application
    {
      name      : "API",
      script    : "http.js",
      interpreter : "node@6.9.0"
    }
  ]
}


================================================
FILE: examples/custom-nodejs-version/http.js
================================================

var http = require('http');

console.log(process.version);

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(process.env.PORT || 8000, function() {
  console.log('App listening on port %d in env %s', process.env.PORT || 8000, process.env.NODE_ENV);

  // 1# Notify application ready
  setTimeout(function() {
    process.send('ready');
  }, 2000);

});

// // 2# Handle on Exit
process.on('SIGINT', function() {
  console.log('Cleanup on exit');

  server.on('close', function() {
    console.log('Connections closed');
    process.exit(0);
  });

  server.close();
});


================================================
FILE: examples/docker-pm2/Dockerfile
================================================
FROM keymetrics/pm2:latest-alpine

# Bundle APP files
COPY ./app /app
WORKDIR /app

# Install app dependencies
ENV NPM_CONFIG_LOGLEVEL warn
RUN npm install --production

ENV KEYMETRICS_SECRET xxxx
ENV KEYMETRICS_PUBLIC yyyy

CMD [ "pm2-runtime", "process.config.js" ]


================================================
FILE: examples/docker-pm2/README.md
================================================

Here is an example on using pm2 inside container with the official image and pm2-runtime.

To build & run it:

```bash
# build image
$ docker build -t docker-pm2-test .
# list images
$ docker images
# run image
$ docker run docker-pm2-test
```

There is also KEYMETRICS integration via KEYMETRICS_SECRET and KEYMETRICS_PUBLIC keys


================================================
FILE: examples/docker-pm2/app/app.js
================================================
const express = require('express')
const app = express()

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(3000, () => console.log('Example app listening on port 3000!'))


================================================
FILE: examples/docker-pm2/app/package.json
================================================
{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.16.2"
  }
}


================================================
FILE: examples/docker-pm2/app/process.config.js
================================================
module.exports = {
  apps : [{
    name   : "express-app",
    script : "./app.js"
  }]
}


================================================
FILE: examples/echo/log.js
================================================


setInterval(function() {
  console.log('out');
}, 1000);

setInterval(function() {
  console.error('err');
}, 1000);


================================================
FILE: examples/echo/stdout.js
================================================

setInterval(function() {
  process.stdout.write('ooo')
}, 100)


================================================
FILE: examples/ecosystem-file/README.md
================================================

Here we have 3 applications (apps folder) that we can start with process file.
These process file can be of different format, javascript, json or yaml:

```
.
├── apps
│   ├── connection_check.sh
│   ├── http.js
│   └── worker.js
├── process.config.js
├── process.json
└── process.yml
```

To start them:

```bash
$ pm2 start process.config.js
$ pm2 delete all
$ pm2 start process.json
$ pm2 delete all
$ pm2 start process.yml
```


================================================
FILE: examples/ecosystem-file/apps/connection_check.sh
================================================
#!/bin/bash

foo() {
    echo "Hello Bash!"
}

while true; do foo; sleep 2; done


================================================
FILE: examples/ecosystem-file/apps/http.js
================================================

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(process.env.PORT || 8000, function() {
  console.log('App listening on port %d in env %s', process.env.PORT || 8000, process.env.NODE_ENV);
});


================================================
FILE: examples/ecosystem-file/apps/worker.js
================================================

setInterval(function() {
  console.log('Worker has finished his job.');
  console.error('Worker has finished his job.');
}, 1000);


================================================
FILE: examples/ecosystem-file/process.config.js
================================================
module.exports = {
  apps : [{
    name               : 'HTTP-API',
    script             : 'apps/http.js',
    exec_mode          : 'cluster',
    instances          : 'max',
    max_memory_restart : '260M',

    ignore_watch       : ['node_modules'],
    env : {
      NODE_ENV : 'normal'
    },
    env_production : {
      NODE_ENV : 'production'
    }
  }, {
    name               : 'Worker',
    script             : 'apps/worker.js',
    err_file : 'toto-err.log'
  }, {
    name               : 'Checks',
    script             : 'apps/connection_check.sh'
  }]
}


================================================
FILE: examples/ecosystem-file/process.json
================================================
{
  apps : [{
    name               : 'HTTP-API',
    script             : 'apps/http.js',
    exec_mode          : 'cluster',
    instances          : 'max',
    max_memory_restart : '260M',

    ignore_watch       : ['node_modules'],
    watch              : true,
    env : {
      NODE_ENV : 'normal'
    },
    env_production : {
      NODE_ENV : 'production'
    }
  }, {
    name               : 'Worker',
    script             : 'apps/worker.js'
  }, {
    name               : 'Checks',
    script             : 'apps/connection_check.sh'
  }]
}


================================================
FILE: examples/ecosystem-file/process.yml
================================================
apps:
  - name : 'HTTP-API'
    script: 'apps/http.js'
    instances: 'max'
    max_memory_restart: '260M'
    watch : true
    ignore_watch : ['node_modules']
    env:
      NODE_ENV : 'development'
    env_production:
      NODE_ENV : 'production'
  - name : 'Worker'
    script: 'apps/worker.js'
  - name : 'Checks'
    script : 'apps/connection_check.sh'


================================================
FILE: examples/esm/addTwo.js
================================================
// addTwo.mjs
function addTwo(num) {
  return num + 2;
}

export { addTwo };


================================================
FILE: examples/esm/app.js
================================================

// app.mjs
import { addTwo } from './addTwo.js';

// Prints: 6
console.log(addTwo(4));


================================================
FILE: examples/esm/package.json
================================================
{
  "name": "esm",
  "version": "1.0.0",
  "description": "",
  "main": "addTwo.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


================================================
FILE: examples/exception/fast.js
================================================
setTimeout(() => {
  throw new Error('err')
}, 100)


================================================
FILE: examples/exception/slow.js
================================================
setTimeout(() => {
  throw new Error('err')
}, 1500)


================================================
FILE: examples/expose-custom-metrics/README.md
================================================

To expose custom metrics from your code and monitor it from CLI:

```bash
$ pm2 start process.config.js
```

Then to monitor metrics:

```bash
$ pm2 monit
```

Or

```bash
$ pm2 show 0
```


================================================
FILE: examples/expose-custom-metrics/process-metrics.js
================================================

var Probe = require('pmx').probe();

var i = 0;

var metric = Probe.metric({
  name    : 'Metric',
  value   : function() {
    return i;
  }
});

setInterval(function() {
  i++;
}, 100);


var meter = Probe.meter({
  name    : 'Meter'
});

setInterval(function() {
  meter.mark()
}, 200);

var histo = Probe.histogram({
  name    : 'Histogram'
});

var latency;

setInterval(function() {
  latency = Math.round(Math.random() * 100);
  histo.update(latency);
}, 100);

var counter = Probe.counter({
  name    : 'Counter'
});

setInterval(function() {
  counter.inc()
}, 500);


================================================
FILE: examples/expose-custom-metrics/process.config.js
================================================
module.exports = {
  apps : [{
    script : 'process-metrics.js'
  }]
}


================================================
FILE: examples/expose-triggerable-functions/index.js
================================================

var pmx = require('pmx');

pmx.action('ping', function(reply) {
  return reply({ 'pong' : 'hehe' })
});

pmx.action('param', function(data, reply) {
  return reply({ data : data })
});

setInterval(function() {
}, 1000);


================================================
FILE: examples/expose-triggerable-functions/process.yml
================================================
- script : './index.js'
  name : 'custom-actions'


================================================
FILE: examples/expose-triggerable-functions/trigger-param.js
================================================
var pm2 = require('../..');

pm2.trigger('0', 'param', { some : 'data' }, function(err, res) {
  var rep_1 = res[0];
  console.log(`Got result from ${rep_1.process.name}`);
  console.log(rep_1.data);

  pm2.disconnect();
});


================================================
FILE: examples/expose-triggerable-functions/trigger-ping.js
================================================
var pm2 = require('../..');

pm2.trigger('0', 'ping', function(err, res) {
  var rep_1 = res[0];
  console.log(`Got result from ${rep_1.process.name}`);
  console.log(rep_1.data);

  pm2.disconnect();
});


================================================
FILE: examples/import/circle.js
================================================
const PI = 3.14159265359;

export function area(radius) {
  return (radius ** 2) * PI;
}

export function circumference(radius) {
  return 2 * radius * PI;
}


================================================
FILE: examples/import/index.js
================================================
import { area, circumference } from './circle.js';

const r = 3;

console.log(`Circle with radius ${r} has
  area: ${area(r)};
  circunference: ${circumference(r)}`);


================================================
FILE: examples/import/package.json
================================================
{
  "name": "import",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type":"module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


================================================
FILE: examples/interact-via-stdin/README.md
================================================

To interact with an app readin on stdin:


```
$ pm2 start stdin.js
```

Then to attach to it:

```
$ pm2 attach 0
```


================================================
FILE: examples/interact-via-stdin/stdin.js
================================================

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.prompt();

rl.on('line', (data) =>{
  console.log('Received data');
  console.log(data);
});

setInterval(() => {
  //console.log('Yes');
}, 2000);


================================================
FILE: examples/misc-examples/001-test.js
================================================



setInterval(function() {
  console.log('log message from echo.js');
}, 1500);

setTimeout(function() {
  setInterval(function() {
    console.error('err msg from echo.js');
  }, 1500);
}, 750);


================================================
FILE: examples/misc-examples/apps/all-pm2.json
================================================
[{
  "name"      : "echo",
  "script"    : "./examples/echo.js",
  "instances" : "1"
},{
  "name"      : "api",
  "script"    : "./examples/child.js",
  "instances" : "4",
  "error_file" : "./examples/child-err.log",
  "out_file" : "./examples/child-out.log"
}]


================================================
FILE: examples/misc-examples/apps/args.json
================================================
{
  "name"      : "echo",
  "script"    : "./examples/args.js",
  "instances" : "1",
  "args"      : "['--toto=heya coco', '-d', '1']",
  "cron_restart" : "* * * * * *"
}


================================================
FILE: examples/misc-examples/apps/auto-kill-echo.json
================================================
{
  "name" : "auto-kill",
  "script" : "./examples/echokill.js",
  "max" : "10"
}


================================================
FILE: examples/misc-examples/apps/cluster-pm2.json
================================================
{
  "script" : "./examples/child.js",
  "error_file" : "errLog.log",
  "out_file" : "outLog.log",
  "pid_file" : "child",
  "instances" : "4",
  "min_uptime" : "10",
  "max_restarts" : "4"
}


================================================
FILE: examples/misc-examples/apps/cron-pm2.json
================================================
{
  "name"      : "echo",
  "script"    : "./examples/args.js",
  "instances" : "1",
  "args"      : "['--toto=heya coco', '-d', '1']",
  "cron_restart" : "* * * * * *"
}


================================================
FILE: examples/misc-examples/apps/default-path-echo.json
================================================
{
  "name" : "echo-default",
  "script" : "examples/echo.js",
  "max" : "1"
}


================================================
FILE: examples/misc-examples/apps/echo-pm2.json
================================================
{
  "script" : "examples/echo.js",
  "error_file" : "errEcho.log",
  "out_file" : "outEcho.log",
  "name" : "ok",
  "pid_file" : "echo.pid",
  "max" : "1",
  "exec_mode" : "cluster_mode",
  "port" : "9001",
  "env_variable" : "TOTO"
}


================================================
FILE: examples/misc-examples/apps/env-pm2.json
================================================
{
  "script" : "examples/env.js",
  "error_file" : "errEcho.log",
  "out_file" : "outEcho.log",
  "name" : "ok",
  "pid_file" : "echo.pid",
  "max" : "1",
  "exec_mode" : "cluster_mode",
  "port" : "9001",
  "env_variable" : "TOTO",
  "TEST_VARIABLE" : "YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSIR"
}


================================================
FILE: examples/misc-examples/apps/killfast.json
================================================
{
  "min_uptime" : "100",
  "max_restarts" : "400",
  "name" : "auto-kill",
  "script" : "./examples/killfast.js"
}


================================================
FILE: examples/misc-examples/apps/multi-pm2.json
================================================
[{
  "name"      : "echo",
  "script"    : "./examples/args.js",
  "instances" : "1",
  "args"      : "['--toto=heya coco', '-d', '1']",
  "cron_restart" : "* * * * * *"
}]


================================================
FILE: examples/misc-examples/apps/no-name-echo.json
================================================
{
  "script" : "examples/echo.js",
  "max" : "1"
}


================================================
FILE: examples/misc-examples/args.js
================================================

process.argv.forEach(function (val, index, array) {
  console.log(index + ': ' + val);
});

console.log('Argv2 = ', process.argv[2]);

setInterval(function() {
  console.log('HERE ARE MY ARGS !!! = ', process.argv);
}, 800);


================================================
FILE: examples/misc-examples/auto-restart-all.js
================================================



var pm2 = require('..');

setTimeout(function() {
  pm2.connect(function() {
    pm2.restart('all', function() {
      pm2.disconnect(function() {

      });
    });
  });
}, 3000);


================================================
FILE: examples/misc-examples/auto-restart-threshold.js
================================================
var pmx = require('pmx');

var Probe = pmx.probe();

var i = 0;

var val = Probe.metric({
  name : 'test',
  value : function() {
    return i;
  },
  alert : {
    mode : 'threshold',
    value : 20,
    msg : 'more than 20',
    func : function() {
      console.log('exiting');
      process.exit(1);
    }
  }
});



setInterval(function() {
  console.log(i);
  i++;
}, 200);


================================================
FILE: examples/misc-examples/auto-save.js
================================================


================================================
FILE: examples/misc-examples/beforeExit.js
================================================

var stopped = false;

function work() {
  console.log('working');
  !stopped && setTimeout(work, 1000);
}

function stop() {
  console.log('shutting down');
  stopped = true;
}

process.once('SIGINT', stop);   // CTRL-C

process.on('beforeExit', function() {
  console.log('exited cleanly :)');
  process.exit(0);
});

work();


================================================
FILE: examples/misc-examples/child-echo.json
================================================
{
  "apps" : [{
    "script":"examples/child.js",
    "name":"API-web",
    "instances":3
  },{
    "script":"examples/echo.js",
    "instances":2
  }],
  "deploy" : {
    "production" : {
      "user" : "node",
      "host" :  "212.83.163.168",
      "repo" : "git@github.com:Unitech/eip-vitrine.git",
      "path" : "/var/www/test-deploy"
    }
  }
}


================================================
FILE: examples/misc-examples/child-env.js
================================================

var http = require('http');

http.createServer(function(req, res) {
  res.writeHead(200);
  res.end(process.env.PORT_ENV);
}).listen(process.env.PORT_ENV);


================================================
FILE: examples/misc-examples/child-pm2.json
================================================
{
  "script":"examples/child.js",
  "name":"SERVERONE",
  "instances":10,
  "error_file":"errfile.log",
  "out_file":"outfile.log",
  "pid_file":"pidfile.pid"
}


================================================
FILE: examples/misc-examples/child.js
================================================

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(process.env.PORT || 8000, function() {
  console.log('App listening on port %d in env %s', process.env.PORT || 8000, process.env.NODE_ENV);
});


================================================
FILE: examples/misc-examples/child.js-pm2.json
================================================
{
  "script":"examples/child.js",
  "name":"child.js"
}


================================================
FILE: examples/misc-examples/child2.js
================================================

var axm = require('pmx');
axm.http();
var http = require('http');

http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hoy');
}).listen(8000);


================================================
FILE: examples/misc-examples/client.js
================================================


var Wrap = require('./wrap.js');
var axon = require('pm2-axon');

var Module = require('module');
Wrap.wrap(Module, '_load', function(load) {
  return function(file) {
    return load.apply(this, arguments);
  }
});


var server = axon.socket('sub');

server.bind(8080);

server.on('bind', function() {
  console.log('Server ready');
});

server.on('message', function(data) {
  console.log(data);
});

// setTimeout(function() {
//   console.log('Closing server');
//   server.close(function() {
//     console.log('Closed');
//   });
// }, 3000);

function setupConnection() {
  var client = axon.socket('pub');

  client.on('connect', function() {
    console.log('Client connected');
  });

  client.on('error', function(e) {
    console.log('Client got error', e.message);
  });

  client.on('close', function(e) {
    console.log('Client got a close');
  });

  client.on('reconnect attempt', function(e) {
    console.log('Reconnecting');
  });

  client.connect(8080);

  this.send = function() {
    client.send({success:true});
  };

  this.destroy = function() {
    client.close();
    client.removeAllListeners();
  };

  this.reconnect = function() {

  };
  return this;
}

var connection = setupConnection();

setInterval(function() {
  connection.send();
}, 1000);

setInterval(function() {
  connection.destroy();
  connection = setupConnection();
}, 2000);


================================================
FILE: examples/misc-examples/cwd.js
================================================


console.log(process.env.PWD);
console.log(process.cwd());
console.log(__dirname);

require('./echo.js');

console.log(process.cwd());



================================================
FILE: examples/misc-examples/echo.coffee
================================================
#!/usr/bin/env coffee

setInterval (-> console.log 'ok'), 500

================================================
FILE: examples/misc-examples/echo.js
================================================


setInterval(function() {
  console.log('log message from echo.js');
  console.warn({ json : true });
}, 1500);

setTimeout(function() {
  setInterval(function() {
    console.error('err msg from echo.js');
  }, 1500);
}, 750);


================================================
FILE: examples/misc-examples/echokill.js
================================================


setInterval(function() {
  console.log('log message from echo auto kill');
}, 800);

setTimeout(function() {
  console.error('error message, killing my self');
  process.exit(10);
}, 3000);


================================================
FILE: examples/misc-examples/env.js
================================================
setInterval(function() {
  console.log('env NODE_ENV = ', process.env.NODE_ENV);
}, 1000);


================================================
FILE: examples/misc-examples/env_args.js
================================================

console.log(process.env.PASSED_VARIABLE);


================================================
FILE: examples/misc-examples/exec_watch.json
================================================
[{
  "script":"examples/child.js",
  "name":"SERVERONE",
  "instances":10,
  "watch" : true,
  "error_file":"errfile.log",
  "out_file":"outfile.log",
  "pid_file":"pidfile.pid"
}]


================================================
FILE: examples/misc-examples/exit.js
================================================

// process.on('exit', function() {
//   console.log('About to exit.');
// });

// process.on('uncaughtException', function(err) {
//   console.log('Caught exception: ' + err);
// });

// process.on('SIGINT', function() {
//   console.log('Got SIGINT.  Press Control-D to exit.');
//   process.exit(1);
// });

var worker = require('cluster').worker;

worker.on('disconnect', function() {
  console.log('exiting');
});


setInterval(function() {
}, 1);

setInterval(function() {
  console.log('ok');
}, 2000);
console.log('ok');


================================================
FILE: examples/misc-examples/expose_method.js
================================================

/*
 * Example of usage : https://github.com/Unitech/pm2/pull/214
 */
process.on("message", function (msg) {
  console.log('got message', msg);
  if ( "type" in msg && msg.type === "god:heap" ) {
    var heap = process.memoryUsage().heapUsed;
    process.send({type:"process:heap", heap:heap});
  }
});


================================================
FILE: examples/misc-examples/graceful-exit.js
================================================

/*
 * Example of graceful exit
 *
 * $ pm2 reload all
 */

process.on('message', function(msg) {
  if (msg == 'shutdown') {
    console.log('Closing all connections...');
    setTimeout(function() {
      console.log('Finished closing connections');
      process.exit(0);
    }, 1500);
  }
});

var http = require('http');

http.createServer(function(req, res) {
  res.writeHead(200);
  console.log('got');
  res.end('hey');
}).listen(8000, function() {
  console.log('listening');
});


================================================
FILE: examples/misc-examples/harmony.js
================================================
var assert = require('assert')
  , s = new Set()
  ;

s.add('a');

assert.ok(s.has('a'));

setInterval(function() {
  console.log(s.has('a'));
}, 1000);


================================================
FILE: examples/misc-examples/http.js
================================================

var pmx = require('pmx');
var conf = pmx.init({
  http: true
});

var http = require('http');

http.createServer(function(req, res) {
  res.writeHead(200);
  res.end('hey');
}).listen(8000);

var Probe = pmx.probe();

var value_to_inspect = 0;

/**
 * .metric, .counter, .meter, .histogram are also available (cf doc)
 */
var val = Probe.metric({
  name : 'test-probe',
  value : function() {
    return value_to_inspect;
  },
  /**
   * Here we set a default value threshold, to receive a notification
   * These options can be overriden via Keymetrics or via pm2
   * More: http://bit.ly/1O02aap
   */
  alert : {
    mode     : 'threshold',
    value    : 20,
    msg      : 'test-probe alert!',
    action   : function(val) {
      // Besides the automatic alert sent via Keymetrics
      // You can also configure your own logic to do something
      console.log('Value has reached %d', val);
    }
  }
});

setInterval(function() {
  // Then we can see that this value increase over the time in Keymetrics
  value_to_inspect++;
}, 300);

process.on('message', function(msg) {
  if (msg == 'shutdown') {
    console.log('Closing all connections...');
    setTimeout(function() {
      console.log('Finished closing connections');
      process.exit(0);
    }, 500);
  }
});


================================================
FILE: examples/misc-examples/infinite-recurse.js
================================================
function x() {
  x();
}
x();


================================================
FILE: examples/misc-examples/inside.js
================================================

var pm2 = require('..');

pm2.connect(function() {
  setInterval(function() {
    pm2.restart('echo', function() {
      console.log(arguments);
    });
  }, 2000);
});


================================================
FILE: examples/misc-examples/inside.json
================================================

[{
  "name" : "inside",
  "script":"examples/inside.js"
},{
  "name" : "echo",
  "script":"examples/echo.js"
}]


================================================
FILE: examples/misc-examples/interact.js
================================================

var pm2 = require('..');

var MACHINE_NAME = 'hk1';
var PRIVATE_KEY  = 'z1ormi95vomgq66';
var PUBLIC_KEY   = 'oa0m7nuhdfibi16';

pm2.connect(true, function() {
  pm2.start({
    script : '../test/fixtures/child.js',
    name : 'production-app'
  }, function() {
    pm2.interact(PRIVATE_KEY, PUBLIC_KEY, MACHINE_NAME, function() {
    });
  });
});


================================================
FILE: examples/misc-examples/json.js
================================================

setInterval(function() {
  console.log({
    hey : 'hay',
    ho : {
      si : 'si',
      ca : ['boum']
    }
  });
  var a = {a: 'a', b: 'b'};
  console.log(a);
}, 1000);


================================================
FILE: examples/misc-examples/kill-not-so-fast.js
================================================

console.log('start');

setTimeout(function() {
  console.log('exit');
  throw new Error('Exitasdsadasdsda unacepted !!');
}, 300);


================================================
FILE: examples/misc-examples/kill-slow.js
================================================

setTimeout(function() {
  console.log('exit');
  process.exit(1);
}, 1000);


================================================
FILE: examples/misc-examples/killfast.js
================================================

process.exit(1);


================================================
FILE: examples/misc-examples/killslow.js
================================================


setTimeout(function() {
  throw new Error('ok');
}, 1100);


================================================
FILE: examples/misc-examples/killtoofast.js
================================================

console.log('im a kamikazy');

setInterval(function() {
  console.log('BOUM');
  process.exit(1);
}, 30);


================================================
FILE: examples/misc-examples/leak.js
================================================

var leak = [];

setInterval(function() {
  for (var i = 0; i < 10; i++) {
    var str = i.toString() + " on a stick, short and stout!";
    leak.push(str);
  }
}, 50);


================================================
FILE: examples/misc-examples/malformated.json
================================================
{
  "apps" : [{
    "exec_interpreter"   : "node,
    "exec_mode"          : "cluster_mode",
    "instances"          : 0,
    "log_date_format"    : "YYYY-MM-DD HH:mm Z",
    "max_memory_restart" : "160",
    "merge_logs"         : true,
    "name"               : "hapi_playground",
    "script"             : "child.js",
    "cwd"                : "examples",
    "node_args"          : "--harmony",
    "ignore_watch"        : ["[\\/\\\\]\\./", "log"],
    "watch"              : true
  }]
}


================================================
FILE: examples/misc-examples/modulechild.js
================================================


console.log(module.parent);


================================================
FILE: examples/misc-examples/moduleparent.js
================================================


var a =require('./modulechild.js');
console.log(module.children);


================================================
FILE: examples/misc-examples/null.js
================================================
var pmx = require('pmx');
var http  = require('http');

http.createServer(function(req, res) {
      res.end('Thanks');
  }).listen(5445);

pmx.action('db:test', {comment: 'Simply test'}, function(reply) {
      reply({test: "WOWOWOWOWOW", length: 12});
  });

pmx.action('throw', {comment: 'Simply test'}, function(reply) {
  throw { success : 'false', length: 12 };
});


================================================
FILE: examples/misc-examples/package.json
================================================
{
  "name": "example-module",
  "version": "0.3.21",
  "description": "Keymetrics++ and PM2 adapter",
  "main": "scoped-action.js",
  "dependencies": {
  },
  "scripts": {
    "test": "DEBUG='axm:*' mocha test/*.mocha.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/keymetrics/pmx.git"
  },
  "config" : {
    "aconfig-var" : true,
    "var2" : false
  },
  "author": "Keymetrics I/O",
  "license": "MIT"
}


================================================
FILE: examples/misc-examples/process.json
================================================
{
  "apps" : [{
    "exec_interpreter"   : "node",
    "exec_mode"          : "cluster_mode",
    "instances"          : 0,
    "log_date_format"    : "YYYY-MM-DD HH:mm Z",
    "max_memory_restart" : "160M",
    "merge_logs"         : true,
    "name"               : "hapi_playground",
    "script"             : "child.js",
    "cwd"                : "examples",
    "node_args"          : "--harmony",
    "ignore_watch"        : ["[\\/\\\\]\\./", "log"],
    "watch"              : true,
    env : {
      NODE_ENV : 'normal'
    },
    env_production : {
      NODE_ENV : 'production'
    }
  }]
}


================================================
FILE: examples/misc-examples/programmatic.js
================================================

var pm2 = require('..');

pm2.connect(function() {

  pm2.start('echo.js', function() {

    setInterval(function() {
      pm2.restart('echo', function() {
      });
    }, 2000);

  });


});

pm2.launchBus(function(err, bus) {
  console.log('connected', bus);

  bus.on('log:out', function(data) {
    if (data.process.name == 'echo')
      console.log(arguments);
  });

  bus.on('reconnect attempt', function() {
    console.log('Bus reconnecting');
  });

  bus.on('close', function() {
    console.log('Bus closed');
  });

});

/**
 * Exiting
 */
//pm2.disconnectBus(); // For Bus system
//pm2.disconnect();    // For RPC connection


================================================
FILE: examples/misc-examples/require.js
================================================

var util = require('util');

console.log(util.inspect(require.main));
setInterval(function() {
  console.log(util.inspect(require.main));
}, 8000);




================================================
FILE: examples/misc-examples/sendmsg.js
================================================

setInterval(function() {
  process.send({
    type : 'miami',
    data : { msg : 'i can communicate with others'}
  });
}, 1000);


================================================
FILE: examples/misc-examples/sigint.js
================================================

process.on('SIGINT', function() {
  // Do othing for tests
});

setInterval(function() {
  console.log('I\'m alive');
}, 2000);


================================================
FILE: examples/misc-examples/start-args.js
================================================


var pm2 = require('..');

pm2.connect(function() {
  pm2.start(__dirname + '/args.js', {
    scriptArgs : ['-i', 'sisi', '-x', 'toto']
  }, function(err, res) {
    console.log(arguments);
  });
});


================================================
FILE: examples/misc-examples/stop-after5.js
================================================

setTim
Download .txt
gitextract_4g07d2ov/

├── .editorconfig
├── .gitattributes
├── .github/
│   ├── CONTRIBUTING.md
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── stale.yml
│   └── workflows/
│       └── node.js.yml
├── .gitignore
├── .mocharc.js
├── .npmignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── GNU-AGPL-3.0.txt
├── LICENSE
├── README.md
├── bin/
│   ├── pm2
│   ├── pm2-dev
│   ├── pm2-docker
│   ├── pm2-runtime
│   ├── pm2-windows
│   └── pm2.ps1
├── constants.js
├── examples/
│   ├── api-pm2/
│   │   ├── README.md
│   │   ├── api.js
│   │   └── http.js
│   ├── c-compile/
│   │   └── hello.c
│   ├── cluster-http/
│   │   ├── README.md
│   │   ├── ecosystem.config.js
│   │   ├── http-no-exit.js
│   │   └── http.js
│   ├── cluster-tcp/
│   │   ├── README.md
│   │   ├── http.js
│   │   ├── process.config.js
│   │   └── tcp.js
│   ├── custom-nodejs-version/
│   │   ├── ecosystem.config.js
│   │   └── http.js
│   ├── docker-pm2/
│   │   ├── Dockerfile
│   │   ├── README.md
│   │   └── app/
│   │       ├── app.js
│   │       ├── package.json
│   │       └── process.config.js
│   ├── echo/
│   │   ├── log.js
│   │   └── stdout.js
│   ├── ecosystem-file/
│   │   ├── README.md
│   │   ├── apps/
│   │   │   ├── connection_check.sh
│   │   │   ├── http.js
│   │   │   └── worker.js
│   │   ├── process.config.js
│   │   ├── process.json
│   │   └── process.yml
│   ├── esm/
│   │   ├── addTwo.js
│   │   ├── app.js
│   │   └── package.json
│   ├── exception/
│   │   ├── fast.js
│   │   └── slow.js
│   ├── expose-custom-metrics/
│   │   ├── README.md
│   │   ├── process-metrics.js
│   │   └── process.config.js
│   ├── expose-triggerable-functions/
│   │   ├── index.js
│   │   ├── process.yml
│   │   ├── trigger-param.js
│   │   └── trigger-ping.js
│   ├── import/
│   │   ├── circle.js
│   │   ├── index.js
│   │   └── package.json
│   ├── interact-via-stdin/
│   │   ├── README.md
│   │   └── stdin.js
│   ├── misc-examples/
│   │   ├── 001-test.js
│   │   ├── apps/
│   │   │   ├── all-pm2.json
│   │   │   ├── args.json
│   │   │   ├── auto-kill-echo.json
│   │   │   ├── cluster-pm2.json
│   │   │   ├── cron-pm2.json
│   │   │   ├── default-path-echo.json
│   │   │   ├── echo-pm2.json
│   │   │   ├── env-pm2.json
│   │   │   ├── killfast.json
│   │   │   ├── multi-pm2.json
│   │   │   └── no-name-echo.json
│   │   ├── args.js
│   │   ├── auto-restart-all.js
│   │   ├── auto-restart-threshold.js
│   │   ├── auto-save.js
│   │   ├── beforeExit.js
│   │   ├── child-echo.json
│   │   ├── child-env.js
│   │   ├── child-pm2.json
│   │   ├── child.js
│   │   ├── child.js-pm2.json
│   │   ├── child2.js
│   │   ├── client.js
│   │   ├── cwd.js
│   │   ├── echo.coffee
│   │   ├── echo.js
│   │   ├── echokill.js
│   │   ├── env.js
│   │   ├── env_args.js
│   │   ├── exec_watch.json
│   │   ├── exit.js
│   │   ├── expose_method.js
│   │   ├── graceful-exit.js
│   │   ├── harmony.js
│   │   ├── http.js
│   │   ├── infinite-recurse.js
│   │   ├── inside.js
│   │   ├── inside.json
│   │   ├── interact.js
│   │   ├── json.js
│   │   ├── kill-not-so-fast.js
│   │   ├── kill-slow.js
│   │   ├── killfast.js
│   │   ├── killslow.js
│   │   ├── killtoofast.js
│   │   ├── leak.js
│   │   ├── malformated.json
│   │   ├── modulechild.js
│   │   ├── moduleparent.js
│   │   ├── null.js
│   │   ├── package.json
│   │   ├── process.json
│   │   ├── programmatic.js
│   │   ├── require.js
│   │   ├── sendmsg.js
│   │   ├── sigint.js
│   │   ├── start-args.js
│   │   ├── stop-after5.js
│   │   ├── string-crash.js
│   │   ├── throw.js
│   │   ├── tree.js
│   │   ├── udp.js
│   │   └── wrap.js
│   ├── module-extra-meta/
│   │   ├── index.js
│   │   └── package.json
│   ├── module-test/
│   │   ├── README.md
│   │   ├── app.js
│   │   └── package.json
│   ├── npm-start/
│   │   ├── http.js
│   │   └── package.json
│   ├── pmx-test-all/
│   │   ├── elements/
│   │   │   ├── cluster.js
│   │   │   ├── counter.js
│   │   │   ├── error.js
│   │   │   ├── event.js
│   │   │   ├── histogram.js
│   │   │   ├── http.js
│   │   │   ├── log-cluster.js
│   │   │   ├── log.js
│   │   │   ├── meter.js
│   │   │   ├── metric.js
│   │   │   ├── notify.js
│   │   │   └── trace.js
│   │   └── process.config.js
│   ├── run-php-python-ruby-bash/
│   │   ├── bashscript.sh
│   │   ├── echo.php
│   │   ├── echo.py
│   │   ├── echo.rb
│   │   ├── leak-mem.py
│   │   └── process.yml
│   ├── send-msg/
│   │   ├── pm2-app.js
│   │   ├── pm2-msg.js
│   │   └── t2.js
│   ├── signal-catching/
│   │   └── graceful-http.js
│   ├── sourcemap-auto-resolve/
│   │   ├── API.js
│   │   ├── README.md
│   │   └── process.config.js
│   ├── start-a-binary/
│   │   ├── ls
│   │   └── ls.yml
│   ├── test-all-keymetrics-features/
│   │   ├── README.md
│   │   ├── actions-fibonacci.js
│   │   ├── custom_action.js
│   │   ├── custom_action_with_params.js
│   │   ├── event.js
│   │   ├── http_app.js
│   │   ├── http_transaction.js
│   │   ├── pm2_probe.js
│   │   ├── probes.js
│   │   ├── process-load.config.js
│   │   ├── process-transpose.js
│   │   ├── process.config.js
│   │   ├── scoped-actions.js
│   │   ├── test-threshold.js
│   │   └── throw.js
│   ├── treekill/
│   │   ├── app.js
│   │   └── process.json
│   ├── udp/
│   │   ├── client.js
│   │   └── server.js
│   ├── using-pm2-and-transpilers/
│   │   ├── README.md
│   │   ├── echo.coffee
│   │   ├── echo.ls
│   │   ├── echo.ts
│   │   ├── http.ts
│   │   └── node.d.ts
│   └── wait-ready/
│       ├── app.js
│       ├── ecosystem.json
│       └── http-simple.js
├── index.js
├── lib/
│   ├── API/
│   │   ├── Configuration.js
│   │   ├── Containerizer.js
│   │   ├── Dashboard.js
│   │   ├── Deploy.js
│   │   ├── Extra.js
│   │   ├── ExtraMgmt/
│   │   │   └── Docker.js
│   │   ├── Log.js
│   │   ├── LogManagement.js
│   │   ├── Modules/
│   │   │   ├── LOCAL.js
│   │   │   ├── Modularizer.js
│   │   │   ├── NPM.js
│   │   │   ├── TAR.js
│   │   │   ├── flagExt.js
│   │   │   └── index.js
│   │   ├── Monit.js
│   │   ├── Serve.js
│   │   ├── Startup.js
│   │   ├── UX/
│   │   │   ├── helpers.js
│   │   │   ├── index.js
│   │   │   ├── pm2-describe.js
│   │   │   ├── pm2-ls-minimal.js
│   │   │   └── pm2-ls.js
│   │   ├── Version.js
│   │   ├── interpreter.json
│   │   ├── pm2-plus/
│   │   │   ├── PM2IO.js
│   │   │   ├── auth-strategies/
│   │   │   │   ├── CliAuth.js
│   │   │   │   └── WebAuth.js
│   │   │   ├── helpers.js
│   │   │   ├── link.js
│   │   │   ├── pres/
│   │   │   │   ├── motd
│   │   │   │   ├── motd.update
│   │   │   │   └── welcome
│   │   │   └── process-selector.js
│   │   └── schema.json
│   ├── API.js
│   ├── Client.js
│   ├── Common.js
│   ├── Configuration.js
│   ├── Daemon.js
│   ├── Event.js
│   ├── God/
│   │   ├── ActionMethods.js
│   │   ├── ClusterMode.js
│   │   ├── ForkMode.js
│   │   ├── Methods.js
│   │   └── Reload.js
│   ├── God.js
│   ├── HttpInterface.js
│   ├── ProcessContainer.js
│   ├── ProcessContainerBun.js
│   ├── ProcessContainerFork.js
│   ├── ProcessContainerForkBun.js
│   ├── ProcessUtils.js
│   ├── TreeKill.js
│   ├── Utility.js
│   ├── VersionCheck.js
│   ├── Watcher.js
│   ├── Worker.js
│   ├── binaries/
│   │   ├── CLI.js
│   │   ├── DevCLI.js
│   │   ├── Runtime.js
│   │   └── Runtime4Docker.js
│   ├── completion.js
│   ├── completion.sh
│   ├── motd
│   ├── templates/
│   │   ├── Dockerfiles/
│   │   │   ├── Dockerfile-java.tpl
│   │   │   ├── Dockerfile-nodejs.tpl
│   │   │   └── Dockerfile-ruby.tpl
│   │   ├── ecosystem-es.tpl
│   │   ├── ecosystem-simple-es.tpl
│   │   ├── ecosystem-simple.tpl
│   │   ├── ecosystem.tpl
│   │   ├── init-scripts/
│   │   │   ├── launchd.tpl
│   │   │   ├── openrc.tpl
│   │   │   ├── pm2-init-amazon.sh
│   │   │   ├── rcd-openbsd.tpl
│   │   │   ├── rcd.tpl
│   │   │   ├── smf.tpl
│   │   │   ├── systemd-online.tpl
│   │   │   ├── systemd.tpl
│   │   │   └── upstart.tpl
│   │   ├── logrotate.d/
│   │   │   └── pm2
│   │   └── sample-apps/
│   │       ├── http-server/
│   │       │   ├── README.md
│   │       │   ├── api.js
│   │       │   ├── ecosystem.config.js
│   │       │   └── package.json
│   │       ├── pm2-plus-metrics-actions/
│   │       │   ├── README.md
│   │       │   ├── custom-metrics.js
│   │       │   ├── ecosystem.config.js
│   │       │   └── package.json
│   │       └── python-app/
│   │           ├── README.md
│   │           ├── echo.py
│   │           ├── ecosystem.config.js
│   │           └── package.json
│   └── tools/
│       ├── Config.js
│       ├── IsAbsolute.js
│       ├── copydirSync.js
│       ├── deleteFolderRecursive.js
│       ├── find-package-json.js
│       ├── fmt.js
│       ├── isbinaryfile.js
│       ├── json5.js
│       ├── open.js
│       ├── passwd.js
│       ├── sexec.js
│       ├── treeify.js
│       ├── which.js
│       └── xdg-open
├── package.json
├── packager/
│   ├── alpine/
│   │   ├── pm2/
│   │   │   └── APKBUILD
│   │   └── pm2_io.rsa.pub
│   ├── build-deb-rpm.sh
│   ├── build-dist.sh
│   ├── debian/
│   │   ├── control
│   │   ├── copyright
│   │   ├── description
│   │   ├── lintian-overrides
│   │   ├── postinst
│   │   ├── postrm
│   │   └── prerm
│   ├── publish_deb_rpm.sh
│   ├── rhel/
│   │   ├── postinst
│   │   ├── postrm
│   │   └── prerm
│   ├── setup.deb.sh
│   └── setup.rpm.sh
├── paths.js
├── pm2
├── preinstall.js
├── pres/
│   └── TMP.md
├── run.sh
├── test/
│   ├── Dockerfile
│   ├── README.md
│   ├── benchmarks/
│   │   ├── monit-daemon.sh
│   │   ├── monit.sh
│   │   └── result.monit
│   ├── docker_parallel_test.sh
│   ├── e2e/
│   │   ├── binaries/
│   │   │   ├── pm2-dev.sh
│   │   │   └── pm2-runtime.sh
│   │   ├── cli/
│   │   │   ├── app-configuration.sh
│   │   │   ├── args.sh
│   │   │   ├── attach.sh
│   │   │   ├── binary.sh
│   │   │   ├── bun.sh
│   │   │   ├── cli-actions-1.sh
│   │   │   ├── cli-actions-2.sh
│   │   │   ├── dump.sh
│   │   │   ├── ecosystem.e2e.sh
│   │   │   ├── env-refresh.sh
│   │   │   ├── extra-lang.sh
│   │   │   ├── fork.sh
│   │   │   ├── mjs.sh
│   │   │   ├── monit.sh
│   │   │   ├── multiparam.sh
│   │   │   ├── operate-regex.sh
│   │   │   ├── piped-config.sh
│   │   │   ├── plus.sh
│   │   │   ├── python-support.sh
│   │   │   ├── reload.sh
│   │   │   ├── reset.sh
│   │   │   ├── resurrect.sh
│   │   │   ├── right-exit-code.sh
│   │   │   ├── serve.sh
│   │   │   ├── smart-start.sh
│   │   │   ├── sort.sh
│   │   │   ├── start-app.sh
│   │   │   ├── startOrX.sh
│   │   │   └── watch.sh
│   │   ├── docker.sh
│   │   ├── esmodule.sh
│   │   ├── file-descriptor.sh
│   │   ├── include.sh
│   │   ├── internals/
│   │   │   ├── daemon-paths-override.sh
│   │   │   ├── increment-var.sh
│   │   │   ├── infinite-loop.sh
│   │   │   ├── listen-timeout.sh
│   │   │   ├── options-via-env.sh
│   │   │   ├── promise.sh
│   │   │   ├── signal.sh
│   │   │   ├── source_map.sh
│   │   │   ├── start-consistency.sh
│   │   │   ├── wait-ready-event.sh
│   │   │   └── wrapped-fork.sh
│   │   ├── logs/
│   │   │   ├── log-create-not-exist-dir.sh
│   │   │   ├── log-custom.sh
│   │   │   ├── log-entire.sh
│   │   │   ├── log-json.sh
│   │   │   ├── log-namespace.sh
│   │   │   ├── log-null.sh
│   │   │   ├── log-reload.sh
│   │   │   └── log-timestamp.sh
│   │   ├── misc/
│   │   │   ├── cron-system.sh
│   │   │   ├── inside-pm2.sh
│   │   │   ├── instance-number.sh
│   │   │   ├── misc.sh
│   │   │   ├── nvm-node-version.sh
│   │   │   ├── port-release.sh
│   │   │   ├── startup.sh
│   │   │   ├── versioning-cmd.sh
│   │   │   └── vizion.sh
│   │   ├── modules/
│   │   │   ├── get-set.sh
│   │   │   ├── module-safeguard.sh
│   │   │   └── module.sh
│   │   ├── process-file/
│   │   │   ├── app-config-update.sh
│   │   │   ├── append-env-to-name.sh
│   │   │   ├── homogen-json-action.sh
│   │   │   ├── js-configuration.sh
│   │   │   ├── json-file.sh
│   │   │   ├── json-reload.sh
│   │   │   └── yaml-configuration.sh
│   │   └── pull.sh
│   ├── e2e.sh
│   ├── fixtures/
│   │   ├── 001-test.js
│   │   ├── all.json
│   │   ├── all2.json
│   │   ├── app-config-update/
│   │   │   ├── args1.json
│   │   │   ├── args2.json
│   │   │   └── echo.js
│   │   ├── append-env-to-name.json
│   │   ├── args/
│   │   │   ├── echo.js
│   │   │   └── params_check.js
│   │   ├── args.js
│   │   ├── bashscript.sh
│   │   ├── big-array-es6.js
│   │   ├── big-array-listen.js
│   │   ├── big-array.js
│   │   ├── binary-js-file
│   │   ├── binary-js-file.js
│   │   ├── binary-py-file.py
│   │   ├── c-compile/
│   │   │   └── hello.c
│   │   ├── change_cwd.json
│   │   ├── child.js
│   │   ├── child_no_http.js
│   │   ├── cluster/
│   │   │   └── sigint_catcher.js
│   │   ├── cluster-alias.json
│   │   ├── cluster-pm2.json
│   │   ├── conf.json
│   │   ├── configuration.js
│   │   ├── configuration.json
│   │   ├── containerizer/
│   │   │   ├── Dockerfile.dev
│   │   │   └── Dockerfile.prod
│   │   ├── cron-stop.js
│   │   ├── cron.js
│   │   ├── cron_no_autorestart.js
│   │   ├── custom_actions/
│   │   │   └── index.js
│   │   ├── delayed_exit.js
│   │   ├── docker/
│   │   │   └── expressor/
│   │   │       ├── Dockerfile.bak
│   │   │       ├── app.js
│   │   │       ├── package.json
│   │   │       ├── process.json
│   │   │       └── worker.js
│   │   ├── echo-env.js
│   │   ├── echo-pm2.json
│   │   ├── echo-post.json
│   │   ├── echo-to-pm2.json
│   │   ├── echo.coffee
│   │   ├── echo.js
│   │   ├── echo2.js
│   │   ├── echo3.js
│   │   ├── echoto-pm2.json
│   │   ├── ecosystem/
│   │   │   └── ecosystem.config.js
│   │   ├── ecosystem.config.js
│   │   ├── ecosystem.json
│   │   ├── ecosystem.json5
│   │   ├── empty.js
│   │   ├── env-ecosystem.json
│   │   ├── env-refreshed.json
│   │   ├── env-switching/
│   │   │   ├── app.json
│   │   │   └── child.js
│   │   ├── env.js
│   │   ├── env.json
│   │   ├── esmodules/
│   │   │   ├── mjs/
│   │   │   │   ├── circle.mjs
│   │   │   │   └── index.mjs
│   │   │   └── packagemodule/
│   │   │       ├── circle.js
│   │   │       ├── index.js
│   │   │       └── package.json
│   │   ├── events/
│   │   │   ├── custom_action.js
│   │   │   ├── custom_action_with_params.js
│   │   │   └── own_event.js
│   │   ├── exitcode42.js
│   │   ├── extra-lang/
│   │   │   ├── app-python.config.js
│   │   │   ├── apps.json
│   │   │   ├── echo.php
│   │   │   └── echo.py
│   │   ├── git/
│   │   │   ├── COMMIT_EDITMSG
│   │   │   ├── HEAD
│   │   │   ├── config
│   │   │   ├── description
│   │   │   ├── hooks/
│   │   │   │   ├── applypatch-msg.sample
│   │   │   │   ├── commit-msg.sample
│   │   │   │   ├── post-update.sample
│   │   │   │   ├── pre-applypatch.sample
│   │   │   │   ├── pre-commit.sample
│   │   │   │   ├── pre-push.sample
│   │   │   │   ├── pre-rebase.sample
│   │   │   │   ├── prepare-commit-msg.sample
│   │   │   │   └── update.sample
│   │   │   ├── index
│   │   │   ├── info/
│   │   │   │   └── exclude
│   │   │   ├── logs/
│   │   │   │   ├── HEAD
│   │   │   │   └── refs/
│   │   │   │       ├── heads/
│   │   │   │       │   └── master
│   │   │   │       └── remotes/
│   │   │   │           └── origin/
│   │   │   │               └── master
│   │   │   ├── objects/
│   │   │   │   ├── 5d/
│   │   │   │   │   └── a45b6659e5cba8f444616f4e18529ad5dde72f
│   │   │   │   ├── 7a/
│   │   │   │   │   └── e6d7c64d39da2167c33993e1f4f0233e8eb6f0
│   │   │   │   └── e6/
│   │   │   │       └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│   │   │   └── refs/
│   │   │       ├── heads/
│   │   │       │   └── master
│   │   │       └── remotes/
│   │   │           └── origin/
│   │   │               └── master
│   │   ├── graceful-exit-no-listen.js
│   │   ├── graceful-exit-send.js
│   │   ├── graceful-exit.js
│   │   ├── homogen-json-action/
│   │   │   ├── all.json
│   │   │   └── http.js
│   │   ├── http.js
│   │   ├── increment-var/
│   │   │   ├── ecosystem.json
│   │   │   └── sample.js
│   │   ├── inside/
│   │   │   ├── echo.js
│   │   │   ├── inner_restart.sh
│   │   │   ├── reload_inside.js
│   │   │   ├── restart_inside.js
│   │   │   └── start_inside.js
│   │   ├── insidePm2Process.js
│   │   ├── interface/
│   │   │   ├── child.js
│   │   │   ├── http_transaction.js
│   │   │   ├── human_event.js
│   │   │   ├── log_out.js
│   │   │   ├── process_exception.js
│   │   │   ├── process_exception_with_logs.js
│   │   │   └── promise_rejection.js
│   │   ├── interpreter/
│   │   │   ├── echo.coffee
│   │   │   ├── echo.ls
│   │   │   ├── echo.ts
│   │   │   └── echo.tsx
│   │   ├── js-configuration/
│   │   │   ├── app.js
│   │   │   └── ecosystem.config.js
│   │   ├── json-reload/
│   │   │   ├── big-array.js
│   │   │   ├── echo-env.js
│   │   │   ├── echo-post.json
│   │   │   ├── echo-pre.json
│   │   │   ├── max-mem-0.json
│   │   │   └── max-mem.json
│   │   ├── killnotsofast.js
│   │   ├── killtoofast.js
│   │   ├── listen-timeout/
│   │   │   └── wait-ready.js
│   │   ├── local_require.js
│   │   ├── log-create-not-exist-dir/
│   │   │   └── echo.js
│   │   ├── log-json/
│   │   │   ├── ecosystem.json
│   │   │   └── one-echo.js
│   │   ├── log-namespace/
│   │   │   └── echo.js
│   │   ├── mjs/
│   │   │   ├── ecosystem.config.js
│   │   │   ├── index.mjs
│   │   │   ├── package.json
│   │   │   └── test.mjs
│   │   ├── module-fixture/
│   │   │   ├── package.json
│   │   │   └── scoped-action.js
│   │   ├── multi-echo.json
│   │   ├── network.js
│   │   ├── no-restart.json
│   │   ├── no-vizion.json
│   │   ├── no_cwd_change.json
│   │   ├── nvm-node-version/
│   │   │   ├── ecosystem-change.json
│   │   │   ├── ecosystem.json
│   │   │   └── http.js
│   │   ├── path-check.js
│   │   ├── path-resolution/
│   │   │   ├── echo.js
│   │   │   ├── ecosystem.config.js
│   │   │   ├── ecosystem2.config.js
│   │   │   └── ecosystem3.config.js
│   │   ├── path1/
│   │   │   ├── iminpath1.js
│   │   │   └── path2/
│   │   │       └── iminpath2.js
│   │   ├── pm2-dev/
│   │   │   ├── app.js
│   │   │   ├── app.json
│   │   │   └── exited_app.js
│   │   ├── pm2-ecosystem.json
│   │   ├── probes.js
│   │   ├── process.json
│   │   ├── promise/
│   │   │   ├── empty-rejection.js
│   │   │   └── rejection.js
│   │   ├── push.json
│   │   ├── python-script.py
│   │   ├── quit.js
│   │   ├── send-data-process/
│   │   │   └── return-data.js
│   │   ├── serve/
│   │   │   ├── 404.html
│   │   │   ├── ecosystem-serve.json
│   │   │   ├── ecosystem.json
│   │   │   ├── index.html
│   │   │   └── other.html
│   │   ├── server.js
│   │   ├── signal-send.js
│   │   ├── signal.js
│   │   ├── signals/
│   │   │   ├── delayed_send.js
│   │   │   └── delayed_sigint.js
│   │   ├── sort/
│   │   │   ├── http.js
│   │   │   └── other.js
│   │   ├── source-map/
│   │   │   ├── main.js
│   │   │   └── models.js
│   │   ├── start-app/
│   │   │   ├── ecosystem-bun.config.js
│   │   │   ├── ecosystem.config.js
│   │   │   └── http.js
│   │   ├── start-consistency/
│   │   │   ├── child.js
│   │   │   └── child.json
│   │   ├── startProcessInsidePm2.js
│   │   ├── startProcessInsidePm2.json
│   │   ├── stdin/
│   │   │   └── stdin.js
│   │   ├── stdout-stderr.js
│   │   ├── stop-exit-codes.json
│   │   ├── throw-later.js
│   │   ├── throw-later.json
│   │   ├── throw-later1.json
│   │   ├── throw-string.js
│   │   ├── throw.js
│   │   ├── toto.js
│   │   ├── wait_ready_event/
│   │   │   ├── http-wait-start.js
│   │   │   └── http-wait-start_nocb.js
│   │   ├── watch/
│   │   │   ├── app-watch-rename.json
│   │   │   ├── app-watch.json
│   │   │   ├── app.json
│   │   │   └── http.js
│   │   ├── watcher/
│   │   │   ├── donotwatchme.dir/
│   │   │   │   └── .gitkeep
│   │   │   ├── server-watch.bak.js
│   │   │   └── server-watch.json
│   │   └── yaml-configuration/
│   │       ├── apps.yaml
│   │       ├── apps.yml
│   │       ├── child.js
│   │       ├── echo.js
│   │       ├── echo.py
│   │       └── malformated.yml
│   ├── helpers/
│   │   ├── apps.js
│   │   └── plan.js
│   ├── interface/
│   │   ├── README.md
│   │   ├── bus.fork.spec.mocha.js
│   │   ├── bus.spec.mocha.js
│   │   ├── mocha.opts
│   │   └── utility.mocha.js
│   ├── parallel.js
│   ├── pm2_check_dependencies.sh
│   ├── programmatic/
│   │   ├── api.backward.compatibility.mocha.js
│   │   ├── api.mocha.js
│   │   ├── auto_restart.mocha.js
│   │   ├── client.mocha.js
│   │   ├── cluster.mocha.js
│   │   ├── common.mocha.js
│   │   ├── conf_update.mocha.js
│   │   ├── configuration.mocha.js
│   │   ├── containerizer.mocha.js
│   │   ├── custom_action.mocha.js
│   │   ├── dump.mocha.js
│   │   ├── env_switching.js
│   │   ├── exp_backoff_restart_delay.mocha.js
│   │   ├── filter_env.mocha.js
│   │   ├── fixtures/
│   │   │   ├── auto-restart/
│   │   │   │   └── throw.js
│   │   │   ├── exp-backoff/
│   │   │   │   ├── throw-stable.js
│   │   │   │   └── throw.js
│   │   │   ├── instances/
│   │   │   │   ├── echo.js
│   │   │   │   └── http.js
│   │   │   ├── json-env-passing/
│   │   │   │   ├── echo.js
│   │   │   │   └── ecosystem.config.js
│   │   │   ├── tar-module/
│   │   │   │   ├── mono-app-module/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── ecosystem.config.js
│   │   │   │   │   ├── http.js
│   │   │   │   │   └── package.json
│   │   │   │   └── multi-app-module/
│   │   │   │       ├── README.md
│   │   │   │       ├── ecosystem.config.js
│   │   │   │       ├── http.js
│   │   │   │       └── package.json
│   │   │   └── version-test/
│   │   │       ├── index.js
│   │   │       └── package.json
│   │   ├── flagExt.mocha.js
│   │   ├── flush.mocha.js
│   │   ├── god.mocha.js
│   │   ├── graceful.mocha.js
│   │   ├── id.mocha.js
│   │   ├── inside.mocha.js
│   │   ├── instances.mocha.js
│   │   ├── internal_config.mocha.js
│   │   ├── issues/
│   │   │   └── json_env_passing_4080.mocha.js
│   │   ├── json_validation.mocha.js
│   │   ├── lazy_api.mocha.js
│   │   ├── logs.js
│   │   ├── max_memory_limit.js
│   │   ├── misc_commands.js
│   │   ├── module_configuration.mocha.js
│   │   ├── module_tar.mocha.js
│   │   ├── modules.mocha.js
│   │   ├── namespace.mocha.js
│   │   ├── path_resolution.mocha.js
│   │   ├── programmatic.js
│   │   ├── reload-locker.mocha.js
│   │   ├── resurect_state.mocha.js
│   │   ├── send_data_process.mocha.js
│   │   ├── signals.js
│   │   ├── sys_infos.mocha.js
│   │   ├── user_management.mocha.js
│   │   ├── version.mocha.js
│   │   └── watcher.js
│   └── unit.sh
└── types/
    ├── index.d.ts
    └── tsconfig.json
Download .txt
SYMBOL INDEX (442 symbols across 91 files)

FILE: examples/c-compile/hello.c
  function main (line 2) | int main()

FILE: examples/esm/addTwo.js
  function addTwo (line 2) | function addTwo(num) {

FILE: examples/import/circle.js
  function area (line 3) | function area(radius) {
  function circumference (line 7) | function circumference(radius) {

FILE: examples/misc-examples/beforeExit.js
  function work (line 4) | function work() {
  function stop (line 9) | function stop() {

FILE: examples/misc-examples/client.js
  function setupConnection (line 33) | function setupConnection() {

FILE: examples/misc-examples/infinite-recurse.js
  function x (line 1) | function x() {

FILE: examples/misc-examples/string-crash.js
  function crash (line 2) | function crash() {

FILE: examples/pmx-test-all/elements/cluster.js
  function makeid (line 15) | function makeid()
  function request (line 26) | function request(path) {

FILE: examples/pmx-test-all/elements/http.js
  function makeid (line 15) | function makeid()
  function request (line 26) | function request(path) {

FILE: examples/pmx-test-all/elements/trace.js
  function makeid (line 15) | function makeid()
  function request (line 26) | function request(path) {

FILE: examples/run-php-python-ruby-bash/leak-mem.py
  function parse_size (line 22) | def parse_size(s: str) -> int:
  function rss_bytes (line 33) | def rss_bytes() -> int:
  function human_readable (line 49) | def human_readable(n: int) -> str:
  function run_leak (line 56) | def run_leak(chunk_size: int, interval: float, max_bytes: int, max_iters...
  function main (line 102) | def main():

FILE: examples/sourcemap-auto-resolve/API.js
  function tryToExit (line 256) | function tryToExit() {
  function processIds (line 320) | function processIds(ids, cb) {
  function show (line 553) | function show() {
  function restartExistingProcessName (line 668) | function restartExistingProcessName(cb) {
  function restartExistingProcessId (line 696) | function restartExistingProcessId(cb) {
  function restartExistingProcessPath (line 710) | function restartExistingProcessPath(cb) {
  function startApps (line 975) | function startApps(app_name_to_start, cb) {
  function processIds (line 1210) | function processIds(ids, cb) {
  function addProcs (line 1522) | function addProcs(proc, value, cb) {
  function rmProcs (line 1530) | function rmProcs(procs, value, cb) {
  function end (line 1539) | function end() {

FILE: examples/test-all-keymetrics-features/actions-fibonacci.js
  function add (line 11) | function add(a, b) {
  function fib (line 36) | function fib(n) {

FILE: examples/test-all-keymetrics-features/http_app.js
  function doRequest (line 27) | function doRequest() {

FILE: examples/test-all-keymetrics-features/http_transaction.js
  function makeid (line 26) | function makeid()
  function request (line 37) | function request(path) {

FILE: examples/using-pm2-and-transpilers/echo.ts
  class Greeter (line 2) | class Greeter {
    method constructor (line 3) | constructor(public greeting: string) { }
    method greet (line 4) | greet() {

FILE: examples/using-pm2-and-transpilers/http.ts
  class MyServer (line 10) | class MyServer {
    method constructor (line 13) | constructor() {
    method onRequest (line 20) | private onRequest(request:Http.ServerRequest, response:Http.ServerResp...

FILE: examples/using-pm2-and-transpilers/node.d.ts
  type Error (line 12) | interface Error {
  type ErrorConstructor (line 16) | interface ErrorConstructor {
  type MapConstructor (line 24) | interface MapConstructor { }
  type WeakMapConstructor (line 25) | interface WeakMapConstructor { }
  type SetConstructor (line 26) | interface SetConstructor { }
  type WeakSetConstructor (line 27) | interface WeakSetConstructor { }
  type NodeRequireFunction (line 47) | interface NodeRequireFunction {
  type NodeRequire (line 51) | interface NodeRequire extends NodeRequireFunction {
  type NodeModule (line 60) | interface NodeModule {
  type BufferEncoding (line 87) | type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "binary" |...
  type Buffer (line 88) | interface Buffer extends NodeBuffer { }
  type ErrnoException (line 235) | interface ErrnoException extends Error {
  type EventEmitter (line 243) | interface EventEmitter {
  type ReadableStream (line 256) | interface ReadableStream extends EventEmitter {
  type WritableStream (line 269) | interface WritableStream extends EventEmitter {
  type ReadWriteStream (line 279) | interface ReadWriteStream extends ReadableStream, WritableStream { }
  type Events (line 281) | interface Events extends EventEmitter { }
  type Domain (line 283) | interface Domain extends Events {
  type MemoryUsage (line 298) | interface MemoryUsage {
  type ProcessVersions (line 304) | interface ProcessVersions {
  type Process (line 315) | interface Process extends EventEmitter {
  type Global (line 380) | interface Global {
  type Timer (line 446) | interface Timer {
  type NodeBuffer (line 455) | interface NodeBuffer extends Uint8Array {
  type StringifyOptions (line 521) | interface StringifyOptions {
  type ParseOptions (line 525) | interface ParseOptions {
  class EventEmitter (line 538) | class EventEmitter implements NodeJS.EventEmitter {
  type RequestOptions (line 564) | interface RequestOptions {
  type Server (line 579) | interface Server extends events.EventEmitter, net.Server {
  type ServerRequest (line 587) | interface ServerRequest extends IncomingMessage {
  type ServerResponse (line 590) | interface ServerResponse extends events.EventEmitter, stream.Writable {
  type ClientRequest (line 620) | interface ClientRequest extends events.EventEmitter, stream.Writable {
  type IncomingMessage (line 646) | interface IncomingMessage extends events.EventEmitter, stream.Readable {
  type ClientResponse (line 674) | interface ClientResponse extends IncomingMessage { }
  type AgentOptions (line 676) | interface AgentOptions {
  class Agent (line 696) | class Agent {
  type ClusterSettings (line 729) | interface ClusterSettings {
  type Address (line 735) | interface Address {
  class Worker (line 741) | class Worker extends events.EventEmitter {
  type ZlibOptions (line 784) | interface ZlibOptions { chunkSize?: number; windowBits?: number; level?:...
  type Gzip (line 786) | interface Gzip extends stream.Transform { }
  type Gunzip (line 787) | interface Gunzip extends stream.Transform { }
  type Deflate (line 788) | interface Deflate extends stream.Transform { }
  type Inflate (line 789) | interface Inflate extends stream.Transform { }
  type DeflateRaw (line 790) | interface DeflateRaw extends stream.Transform { }
  type InflateRaw (line 791) | interface InflateRaw extends stream.Transform { }
  type Unzip (line 792) | interface Unzip extends stream.Transform { }
  type CpuInfo (line 852) | interface CpuInfo {
  type NetworkInterfaceInfo (line 864) | interface NetworkInterfaceInfo {
  type ServerOptions (line 894) | interface ServerOptions {
  type RequestOptions (line 909) | interface RequestOptions extends http.RequestOptions {
  type Agent (line 920) | interface Agent extends http.Agent { }
  type AgentOptions (line 922) | interface AgentOptions extends http.AgentOptions {
  type Server (line 937) | interface Server extends tls.Server { }
  type ucs2 (line 950) | interface ucs2 {
  type ReplOptions (line 961) | interface ReplOptions {
  type Key (line 979) | interface Key {
  type ReadLine (line 987) | interface ReadLine extends events.EventEmitter {
  type Completer (line 997) | interface Completer {
  type CompleterResult (line 1002) | interface CompleterResult {
  type ReadLineOptions (line 1007) | interface ReadLineOptions {
  type Context (line 1025) | interface Context { }
  type ScriptOptions (line 1026) | interface ScriptOptions {
  type RunningScriptOptions (line 1035) | interface RunningScriptOptions {
  class Script (line 1042) | class Script {
  type ChildProcess (line 1060) | interface ChildProcess extends events.EventEmitter {
  type SpawnOptions (line 1074) | interface SpawnOptions {
  type ExecOptions (line 1085) | interface ExecOptions {
  type ExecOptionsWithStringEncoding (line 1095) | interface ExecOptionsWithStringEncoding extends ExecOptions {
  type ExecOptionsWithBufferEncoding (line 1098) | interface ExecOptionsWithBufferEncoding extends ExecOptions {
  type ExecFileOptions (line 1107) | interface ExecFileOptions {
  type ExecFileOptionsWithStringEncoding (line 1116) | interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
  type ExecFileOptionsWithBufferEncoding (line 1119) | interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
  type ForkOptions (line 1133) | interface ForkOptions {
  type SpawnSyncOptions (line 1144) | interface SpawnSyncOptions {
  type SpawnSyncOptionsWithStringEncoding (line 1157) | interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
  type SpawnSyncOptionsWithBufferEncoding (line 1160) | interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
  type SpawnSyncReturns (line 1163) | interface SpawnSyncReturns<T> {
  type ExecSyncOptions (line 1180) | interface ExecSyncOptions {
  type ExecSyncOptionsWithStringEncoding (line 1193) | interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
  type ExecSyncOptionsWithBufferEncoding (line 1196) | interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
  type ExecFileSyncOptions (line 1204) | interface ExecFileSyncOptions {
  type ExecFileSyncOptionsWithStringEncoding (line 1216) | interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOpti...
  type ExecFileSyncOptionsWithBufferEncoding (line 1219) | interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOpti...
  type Url (line 1232) | interface Url {
  type Socket (line 1270) | interface Socket extends stream.Duplex {
  type ListenOptions (line 1313) | interface ListenOptions {
  type Server (line 1321) | interface Server extends Socket {
  type RemoteInfo (line 1355) | interface RemoteInfo {
  type AddressInfo (line 1361) | interface AddressInfo {
  type Socket (line 1369) | interface Socket extends events.EventEmitter {
  type Stats (line 1386) | interface Stats {
  type FSWatcher (line 1410) | interface FSWatcher extends events.EventEmitter {
  type ReadStream (line 1414) | interface ReadStream extends stream.Readable {
  type WriteStream (line 1418) | interface WriteStream extends stream.Writable {
  type ParsedPath (line 1685) | interface ParsedPath {
  type NodeStringDecoder (line 1827) | interface NodeStringDecoder {
  type Certificate (line 1844) | interface Certificate {
  type CipherNameAndProtocol (line 1871) | interface CipherNameAndProtocol {
  class TLSSocket (line 1882) | class TLSSocket extends stream.Duplex {
  type TlsOptions (line 1984) | interface TlsOptions {
  type ConnectionOptions (line 2001) | interface ConnectionOptions {
  type Server (line 2015) | interface Server extends net.Server {
  type ClearTextStream (line 2027) | interface ClearTextStream extends stream.Duplex {
  type SecurePair (line 2044) | interface SecurePair {
  type SecureContextOptions (line 2049) | interface SecureContextOptions {
  type SecureContext (line 2060) | interface SecureContext {
  type CredentialDetails (line 2073) | interface CredentialDetails {
  type Credentials (line 2082) | interface Credentials { context?: any; }
  type Hash (line 2087) | interface Hash {
  type Hmac (line 2093) | interface Hmac extends NodeJS.ReadWriteStream {
  type Cipher (line 2101) | interface Cipher extends NodeJS.ReadWriteStream {
  type Decipher (line 2113) | interface Decipher extends NodeJS.ReadWriteStream {
  type Signer (line 2124) | interface Signer extends NodeJS.WritableStream {
  type Verify (line 2129) | interface Verify extends NodeJS.WritableStream {
  type DiffieHellman (line 2135) | interface DiffieHellman {
  type RsaPublicKey (line 2154) | interface RsaPublicKey {
  type RsaPrivateKey (line 2158) | interface RsaPrivateKey {
  class Stream (line 2170) | class Stream extends events.EventEmitter {
  type ReadableOptions (line 2174) | interface ReadableOptions {
  class Readable (line 2181) | class Readable extends events.EventEmitter implements NodeJS.ReadableStr...
  type WritableOptions (line 2196) | interface WritableOptions {
  class Writable (line 2204) | class Writable extends events.EventEmitter implements NodeJS.WritableStr...
  type DuplexOptions (line 2215) | interface DuplexOptions extends ReadableOptions, WritableOptions {
  class Duplex (line 2222) | class Duplex extends Readable implements NodeJS.ReadWriteStream {
  type TransformOptions (line 2233) | interface TransformOptions extends ReadableOptions, WritableOptions {
  class Transform (line 2239) | class Transform extends events.EventEmitter implements NodeJS.ReadWriteS...
  class PassThrough (line 2261) | class PassThrough extends Transform { }
  type InspectOptions (line 2265) | interface InspectOptions {
  class AssertionError (line 2291) | class AssertionError implements Error {
  type ReadStream (line 2339) | interface ReadStream extends net.Socket {
  type WriteStream (line 2344) | interface WriteStream extends net.Socket {
  class Domain (line 2354) | class Domain extends events.EventEmitter implements NodeJS.Domain {

FILE: lib/API.js
  class API (line 54) | class API {
    method constructor (line 56) | constructor (opts) {
    method connect (line 163) | connect (noDaemon, cb) {
    method destroy (line 199) | destroy (cb) {
    method disconnect (line 226) | disconnect (cb) {
    method close (line 241) | close (cb) {
    method launchModules (line 250) | launchModules (cb) {
    method launchBus (line 260) | launchBus (cb) {
    method exitCli (line 268) | exitCli (code) {
    method start (line 317) | start (cmd, opts, cb) {
    method reset (line 345) | reset (process_name, cb) {
    method update (line 392) | update (cb) {
    method reload (line 440) | reload (process_name, opts, cb) {
    method restart (line 489) | restart (cmd, opts, cb) {
    method delete (line 528) | delete (process_name, jsonVia, cb) {
    method stop (line 561) | stop (process_name, cb) {
    method list (line 592) | list (opts, cb) {
    method killDaemon (line 631) | killDaemon (cb) {
    method kill (line 657) | kill (cb) {
    method _startScript (line 671) | _startScript (script, opts, cb) {
    method _startJson (line 900) | _startJson (file, opts, action, pipe, cb) {
    method actionFromJson (line 1190) | actionFromJson (action, file, opts, jsonVia, cb) {
    method _operate (line 1304) | _operate (action_name, process_name, envs, cb) {
    method _handleAttributeUpdate (line 1588) | _handleAttributeUpdate (opts) {
    method getProcessIdByName (line 1641) | getProcessIdByName (name, cb) {
    method jlist (line 1660) | jlist (debug) {
    method slist (line 1686) | slist (tree) {
    method speedList (line 1708) | speedList (code, apps_acted) {
    method scale (line 1791) | scale (app_name, number, cb) {
    method describe (line 1858) | describe (pm2_id, cb) {
    method deepUpdate (line 1895) | deepUpdate (cb) {

FILE: lib/API/Configuration.js
  function interactiveConfigEdit (line 188) | function interactiveConfigEdit(cb) {
  function displayConf (line 202) | function displayConf(target_app, cb) {

FILE: lib/API/Containerizer.js
  function pspawn (line 12) | function pspawn(cmd) {
  function checkDockerSetup (line 36) | function checkDockerSetup() {
  function parseAndSwitch (line 60) | function parseAndSwitch(file_content, main_file, opts) {
  function switchDockerFile (line 95) | function switchDockerFile(docker_filepath, main_file, opts) {
  function generateDockerfile (line 120) | function generateDockerfile(docker_filepath, main_file, opts) {
  function handleExit (line 139) | function handleExit(CLI, opts, mode) {

FILE: lib/API/Dashboard.js
  function timeSince (line 413) | function timeSince(date) {
  function gradient (line 447) | function gradient(p, rgb_beginning, rgb_end) {

FILE: lib/API/Deploy.js
  function deployHelper (line 12) | function deployHelper() {

FILE: lib/API/Extra.js
  function basicMDHighlight (line 248) | function basicMDHighlight(lines) {
  function refreshDashboard (line 713) | function refreshDashboard() {
  function launchMonitor (line 740) | function launchMonitor() {

FILE: lib/API/ExtraMgmt/Docker.js
  function execDocker (line 8) | function execDocker(cmd, cb) {

FILE: lib/API/Log.js
  function pad (line 307) | function pad(pad, str, padLeft) {

FILE: lib/API/Modules/LOCAL.js
  function install (line 36) | function install(module, cb, verbose) {
  function installMultipleModules (line 57) | function installMultipleModules(modules, cb, post_install) {
  function installLangModule (line 102) | function installLangModule(module_name, cb) {

FILE: lib/API/Modules/Modularizer.js
  function launchNPMModules (line 62) | function launchNPMModules(cb) {
  function launchTARModules (line 73) | function launchTARModules(cb) {

FILE: lib/API/Modules/NPM.js
  function localStart (line 40) | function localStart(PM2, opts, cb) {
  function generateSample (line 63) | function generateSample(app_name, cb) {
  function publish (line 110) | function publish(opts, cb) {
  function moduleExistInLocalDB (line 157) | function moduleExistInLocalDB(CLI, module_name, cb) {
  function install (line 165) | function install(CLI, module_name, opts, cb) {
  function getNPMCommandLine (line 181) | function getNPMCommandLine(module_name, install_path) {
  function continueInstall (line 208) | function continueInstall(CLI, module_name, opts, cb) {
  function start (line 281) | function start(PM2, modules, module_name, cb) {
  function uninstall (line 309) | function uninstall(CLI, module_name, cb) {
  function getModuleConf (line 329) | function getModuleConf(app_name) {
  function StartModule (line 347) | function StartModule(CLI, opts, cb) {

FILE: lib/API/Modules/TAR.js
  function install (line 34) | function install(PM2, module_filepath, opts, cb) {
  function retrieveRemote (line 55) | function retrieveRemote(url, dest, cb) {
  function installLocal (line 76) | function installLocal(PM2, module_filepath, opts, cb) {
  function deleteModulePath (line 110) | function deleteModulePath(module_name) {
  function runInstall (line 115) | function runInstall(PM2, target_path, module_name, opts, cb) {
  function start (line 169) | function start(PM2, module_name, cb) {
  function uninstall (line 208) | function uninstall(PM2, module_name, cb) {
  function getModuleName (line 254) | function getModuleName(module_filepath, cb) {
  function packager (line 273) | function packager(module_path, target_path, cb) {
  function publish (line 299) | function publish(PM2, folder, cb) {
  function needPrefix (line 356) | function needPrefix(conf) {

FILE: lib/API/Modules/flagExt.js
  function find_extensions (line 4) | function  find_extensions(folder, ext, ret)

FILE: lib/API/Monit.js
  constant RATIO_T1 (line 20) | const RATIO_T1   = Math.floor(os.totalmem() / 500);
  constant RATIO_T2 (line 22) | const RATIO_T2   = Math.floor(os.totalmem() / 50);
  constant RATIO_T3 (line 24) | const RATIO_T3   = Math.floor(os.totalmem() / 5);
  constant RATIO_T4 (line 26) | const RATIO_T4   = Math.floor(os.totalmem());

FILE: lib/API/Serve.js
  function serveFile (line 250) | function serveFile(uri, request, response) {
  function parseBasicAuth (line 323) | function parseBasicAuth(auth) {
  function sendBasicAuthResponse (line 337) | function sendBasicAuthResponse(response) {

FILE: lib/API/Startup.js
  function isNotRoot (line 22) | function isNotRoot(startup_mode, platform, opts, cb) {
  function detectInitSystem (line 44) | function detectInitSystem() {
  function getTemplate (line 234) | function getTemplate(type) {
  function fin (line 447) | function fin(err) {
  function readDumpFile (line 544) | function readDumpFile(dumpFilePath) {
  function parseDumpFile (line 556) | function parseDumpFile(dumpFilePath, apps) {

FILE: lib/API/UX/pm2-ls.js
  constant CONDENSED_MODE (line 12) | const CONDENSED_MODE = (process.stdout.columns || 300) < 134
  function checkIfProcessAreDumped (line 17) | function checkIfProcessAreDumped(list) {
  function listModulesAndAppsManaged (line 41) | function listModulesAndAppsManaged(list, commander) {
  function containersListing (line 303) | function containersListing(sys_infos) {
  function listHighResourcesProcesses (line 363) | function listHighResourcesProcesses(sys_infos) {
  function miniMonitBar (line 410) | function miniMonitBar(sys_infos) {

FILE: lib/API/pm2-plus/PM2IO.js
  constant IOAPI (line 9) | const IOAPI = require('@pm2/js-api')
  constant OAUTH_CLIENT_ID_WEB (line 15) | const OAUTH_CLIENT_ID_WEB = '138558311'
  constant OAUTH_CLIENT_ID_CLI (line 16) | const OAUTH_CLIENT_ID_CLI = '0943857435'
  method usePM2Client (line 20) | static usePM2Client (instance) {
  method strategy (line 24) | static strategy () {
  method init (line 57) | static init () {
  method launch (line 71) | static launch (command, opts) {
  method openUI (line 160) | static openUI () {
  method validateAccount (line 209) | static validateAccount (token) {
  method createBucketHandler (line 231) | static createBucketHandler (err, bucket) {
  method createBucket (line 250) | static createBucket (cb) {
  method connectToBucket (line 279) | static connectToBucket (cb) {
  method authenticate (line 321) | static authenticate () {
  method open (line 341) | static open (target, appName, callback) {

FILE: lib/API/pm2-plus/auth-strategies/CliAuth.js
  method retrieveTokens (line 20) | retrieveTokens (km, cb) {
  method isAuthenticated (line 28) | isAuthenticated () {
  method verifyToken (line 51) | verifyToken (refresh) {
  method _retrieveTokens (line 59) | _retrieveTokens (optionalCallback) {
  method authenticate (line 119) | authenticate (cb) {
  method login (line 127) | login (cb) {
  method register (line 153) | register (cb) {
  method _registerUser (line 202) | _registerUser (opts, cb) {
  method _loginUser (line 226) | _loginUser (user_info, cb) {
  method _validateEmail (line 262) | _validateEmail (email) {
  method _validateUsername (line 269) | _validateUsername (value) {
  method deleteTokens (line 276) | deleteTokens (km) {

FILE: lib/API/pm2-plus/auth-strategies/WebAuth.js
  method retrieveTokens (line 15) | retrieveTokens (km, cb) {
  method isAuthenticated (line 22) | isAuthenticated () {
  method _retrieveTokens (line 46) | _retrieveTokens (optionalCallback) {
  method loginViaWeb (line 111) | loginViaWeb (cb) {
  method deleteTokens (line 143) | deleteTokens (km) {
  method open (line 156) | open (target, appName, callback) {

FILE: lib/API/pm2-plus/helpers.js
  function processesAreAlreadyMonitored (line 10) | function processesAreAlreadyMonitored(CLI, cb) {
  function install (line 57) | function install(cb) {

FILE: lib/API/pm2-plus/process-selector.js
  function monitor (line 22) | function monitor (pm_id, cb) {

FILE: lib/Client.js
  function noop (line 19) | function noop() {}
  function onError (line 264) | function onError(e) {
  function quit (line 558) | function quit() {

FILE: lib/Common.js
  function homedir (line 28) | function homedir() {
  function resolveHome (line 48) | function resolveHome(filepath) {
  function filterEnv (line 192) | function filterEnv (envObj) {
  function warn (line 909) | function warn(warning){

FILE: lib/Configuration.js
  function splitKey (line 15) | function splitKey(key) {
  function serializeConfiguration (line 26) | function serializeConfiguration(json_conf) {

FILE: lib/Daemon.js
  function profile (line 161) | function profile(type, msg, cb) {

FILE: lib/God/ActionMethods.js
  function fin (line 141) | function fin(err) {
  function saveProc (line 186) | function saveProc(apps) {
  function filterBadProcess (line 887) | function filterBadProcess(pro) {
  function getProcessId (line 901) | function getProcessId(pro) {

FILE: lib/God/ForkMode.js
  function transformLogToJson (line 133) | function transformLogToJson(pm2_env, type, data) {
  function prefixLogWithDate (line 143) | function prefixLogWithDate(pm2_env, data) {

FILE: lib/God/Reload.js
  function softReload (line 25) | function softReload(God, id, cb) {
  function hardReload (line 108) | function hardReload(God, id, wait_msg, cb) {

FILE: lib/HttpInterface.js
  function startWebServer (line 18) | function startWebServer(pm2) {

FILE: lib/ProcessContainer.js
  function exec (line 113) | function exec(script, stds) {

FILE: lib/ProcessContainerBun.js
  function exec (line 106) | function exec(script, stds) {

FILE: lib/ProcessUtils.js
  method isESModule (line 22) | isESModule(exec_path) {

FILE: lib/TreeKill.js
  function killAll (line 42) | function killAll (tree, signal, callback) {
  function killPid (line 69) | function killPid(pid, signal) {
  function buildProcessTree (line 79) | function buildProcessTree (parentPid, tree, pidsToProcess, spawnChildPro...

FILE: lib/Utility.js
  function timestamp (line 100) | function timestamp(){

FILE: lib/VersionCheck.js
  function hasDockerEnv (line 7) | function hasDockerEnv() {
  function hasDockerCGroup (line 16) | function hasDockerCGroup() {

FILE: lib/binaries/CLI.js
  function displayUsage (line 99) | function displayUsage() {
  function displayExamples (line 109) | function displayExamples() {
  function beginCommandProcessing (line 144) | function beginCommandProcessing() {
  function checkCompletion (line 157) | function checkCompletion(){
  function failOnUnknown (line 236) | function failOnUnknown(fn) {
  function patchCommanderArg (line 253) | function patchCommanderArg(cmd) {
  function plusHandler (line 624) | function plusHandler (command, opts) {

FILE: lib/binaries/DevCLI.js
  function postExecCmd (line 42) | function postExecCmd(command, cb) {
  function run (line 64) | function run(cmd, opts) {
  function exitPM2 (line 143) | function exitPM2() {
  function autoExit (line 154) | function autoExit(final) {

FILE: lib/binaries/Runtime.js
  function exitPM2 (line 88) | function exitPM2() {

FILE: lib/binaries/Runtime4Docker.js
  function exec (line 110) | function exec() {

FILE: lib/completion.js
  function trim (line 113) | function trim (s) {
  function cleanPrefix (line 117) | function cleanPrefix(s) {
  function abbrev (line 121) | function abbrev(o) { return function(it) {
  function script (line 128) | function script(name, completer, cb) {
  function install (line 137) | function install(name, completer, cb) {
  function uninstall (line 170) | function uninstall(name, completer, cb) {
  function readRc (line 190) | function readRc(completer, cb) {
  function writeRc (line 199) | function writeRc(content, cb) {
  function installed (line 208) | function installed (marker, completer, cb) {
  function parseEnv (line 216) | function parseEnv() {

FILE: lib/tools/Config.js
  method schema (line 23) | get schema(){

FILE: lib/tools/IsAbsolute.js
  function posix (line 3) | function posix(path) {
  function win32 (line 7) | function win32(path) {

FILE: lib/tools/copydirSync.js
  function copydirSync (line 11) | function copydirSync(from, to, options) {
  function listDirectorySync (line 70) | function listDirectorySync(from, to, options) {
  function copyFromArraySync (line 75) | function copyFromArraySync(files, from, to, options) {
  function writeFileSync (line 82) | function writeFileSync(from, to, options, stats) {
  function rewriteSync (line 88) | function rewriteSync(f, options, stats, callback) {

FILE: lib/tools/find-package-json.js
  function parse (line 13) | function parse(data) {

FILE: lib/tools/isbinaryfile.js
  function isBinaryCheck (line 50) | function isBinaryCheck(bytes, size) {

FILE: lib/tools/json5.js
  function isWordChar (line 548) | function isWordChar(char) {
  function isWordStart (line 555) | function isWordStart(char) {
  function isWord (line 561) | function isWord(key) {
  function isArray (line 582) | function isArray(obj) {
  function isDate (line 590) | function isDate(obj) {
  function checkForCircular (line 599) | function checkForCircular(obj) {
  function makeIndent (line 607) | function makeIndent(str, num, noNewLine) {
  function escapeString (line 649) | function escapeString(string) {
  function internalStringify (line 665) | function internalStringify(holder, key, isTopLevel) {

FILE: lib/tools/open.js
  function open (line 20) | function open(target, appName, callback) {
  function escape (line 61) | function escape(s) {

FILE: lib/tools/sexec.js
  function _exec (line 8) | function _exec(command, options, callback) {

FILE: lib/tools/treeify.js
  function makePrefix (line 18) | function makePrefix(key, last) {
  function filterKeys (line 28) | function filterKeys(obj, hideFunctions) {
  function growBranch (line 44) | function growBranch(key, root, last, lastStates, showValues, hideFunctio...

FILE: lib/tools/which.js
  function statFollowLinks (line 13) | function statFollowLinks() {
  function isWindowsPlatform (line 17) | function isWindowsPlatform() {
  function splitPath (line 22) | function splitPath(p) {
  function isExecutable (line 28) | function isExecutable(pathName) {
  function checkPath (line 38) | function checkPath(pathName) {
  function _which (line 56) | function _which(cmd) {

FILE: paths.js
  function getDefaultPM2Home (line 11) | function getDefaultPM2Home() {

FILE: test/fixtures/c-compile/hello.c
  function main (line 2) | int main()

FILE: test/fixtures/esmodules/mjs/circle.mjs
  function area (line 3) | function area(radius) {
  function circumference (line 7) | function circumference(radius) {

FILE: test/fixtures/esmodules/packagemodule/circle.js
  function area (line 3) | function area(radius) {
  function circumference (line 7) | function circumference(radius) {

FILE: test/fixtures/interface/http_transaction.js
  function makeid (line 21) | function makeid() {
  function request (line 31) | function request(path) {

FILE: test/fixtures/interpreter/echo.ts
  class Greeter (line 2) | class Greeter {
    method constructor (line 3) | constructor(public greeting: string) { }
    method greet (line 4) | greet() {

FILE: test/fixtures/interpreter/echo.tsx
  class Greeter (line 2) | class Greeter {
    method constructor (line 3) | constructor(public greeting: string) { }
    method greet (line 4) | greet() {

FILE: test/fixtures/mjs/test.mjs
  function test (line 1) | function test() {

FILE: test/fixtures/source-map/models.js
  function UserMessage (line 3) | function UserMessage(payload) {

FILE: test/fixtures/throw-string.js
  function crash (line 2) | function crash() {

FILE: test/helpers/plan.js
  function Plan (line 11) | function Plan(count, done) {

FILE: test/interface/bus.spec.mocha.js
  constant PATH_FIXTURES (line 6) | const PATH_FIXTURES = process.cwd() + '/test/interface/fixtures/';

FILE: test/parallel.js
  constant CONCURRENT_TEST (line 11) | const CONCURRENT_TEST = 3
  constant DOCKER_IMAGE_NAME (line 12) | const DOCKER_IMAGE_NAME = 'pm2-test'
  function run (line 16) | function run(cmd, cb) {
  function buildContainer (line 29) | function buildContainer(cb) {
  function listAllTest (line 33) | function listAllTest(cb) {
  function launchTestSuite (line 52) | function launchTestSuite(files, cb) {

FILE: test/programmatic/conf_update.mocha.js
  constant PM2 (line 2) | const PM2 = require('../..');

FILE: test/programmatic/exp_backoff_restart_delay.mocha.js
  constant PM2 (line 5) | const PM2 = require('../..');

FILE: test/programmatic/god.mocha.js
  function getConf (line 23) | function getConf() {
  function getConf2 (line 32) | function getConf2() {
  function getConf3 (line 41) | function getConf3() {
  function getConf4 (line 50) | function getConf4() {
  function deleteAll (line 59) | function deleteAll(data, cb) {

FILE: test/programmatic/internal_config.mocha.js
  constant PM2 (line 2) | const PM2 = require('../..');

FILE: test/programmatic/module_tar.mocha.js
  constant PM2 (line 2) | const PM2 = require('../..');

FILE: test/programmatic/modules.mocha.js
  constant PM2 (line 2) | const PM2 = require('../..');

FILE: test/programmatic/version.mocha.js
  constant PM2 (line 2) | const PM2 = require('../..');

FILE: test/programmatic/watcher.js
  function testPM2Env (line 24) | function testPM2Env(event) {
  function errShouldBeNull (line 44) | function errShouldBeNull(err) {

FILE: types/index.d.ts
  type Proc (line 316) | interface Proc {
  type Command (line 345) | interface Command {
  type ProcessDescription (line 356) | interface ProcessDescription {
  type Monit (line 376) | interface Monit {
  type Pm2Env (line 390) | interface Pm2Env {
  type StartOptions (line 427) | interface StartOptions {
  type ReloadOptions (line 630) | interface ReloadOptions {
  type ServeOptions (line 641) | interface ServeOptions {
  type DockerOptions (line 663) | interface DockerOptions {
  type InstallOptions (line 689) | interface InstallOptions {
  type ProcessStatus (line 714) | type ProcessStatus = 'online' | 'stopping' | 'stopped' | 'launching' | '...
  type Platform (line 715) | type Platform = 'ubuntu' | 'centos' | 'redhat' | 'gentoo' | 'systemd' | ...
  type ErrCallback (line 717) | type ErrCallback = (err: Error) => void;
  type ErrProcCallback (line 718) | type ErrProcCallback = (err: Error, proc: Proc) => void;
  type ErrProcDescCallback (line 719) | type ErrProcDescCallback = (err: Error, processDescription: ProcessDescr...
  type ErrProcDescsCallback (line 720) | type ErrProcDescsCallback = (err: Error, processDescriptionList: Process...
  type ErrResultCallback (line 721) | type ErrResultCallback = (err: Error, result: any) => void;
  type ErrBusCallback (line 722) | type ErrBusCallback = (err: Error, bus: any) => void;
Condensed preview — 691 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,504K chars).
[
  {
    "path": ".editorconfig",
    "chars": 273,
    "preview": "# top-most EditorConfig file\nroot = true\n\n# Unix-style newlines with a newline ending every file\n[*]\nend_of_line = lf\nch"
  },
  {
    "path": ".gitattributes",
    "chars": 62,
    "preview": "* text=auto\n*.sh eol=lf\nbin/** eol=lf\ntest/fixtures/** eol=lf\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 1794,
    "preview": "# Contributing to PM2\n\n## Pull-Requests\n\n1. Fork pm2\n2. Create a different branch to do your fixes/improvements if it's "
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 140,
    "preview": "## What's going wrong?\n\n## How could we reproduce this issue?\n\n## Supporting information\n\n```\n# Run the following comman"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 425,
    "preview": "<!--\nPlease always submit pull requests on the development branch.\n-->\n| Q             | A\n| ------------- | ---\n| Bug f"
  },
  {
    "path": ".github/stale.yml",
    "chars": 852,
    "preview": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 30\n# Number of days of inactivity before a "
  },
  {
    "path": ".github/workflows/node.js.yml",
    "chars": 1359,
    "preview": "name: Node.js CI\n\non: [push, pull_request]\n\njobs:\n\n  node-tests:\n    runs-on: ubuntu-latest\n    timeout-minutes: 30\n\n   "
  },
  {
    "path": ".gitignore",
    "chars": 266,
    "preview": "/node_modules\n*.log\n*.pid\ntest/child\n*.iml\n.idea/**\n*.heapsnapshot\n*.cpuprofile\n.cache-require-paths.json\ndist/\n*.deb\n*."
  },
  {
    "path": ".mocharc.js",
    "chars": 216,
    "preview": "\nmodule.exports = {\n  'allow-uncaught' : false,\n  'async-only': false,\n  bail: true,\n  color: true,\n  delay: false,\n  di"
  },
  {
    "path": ".npmignore",
    "chars": 146,
    "preview": "test\napps\ndoc\n/pres\n*.log\n*.pid\nexamples\n*.pyc\n.github\n.cache-require-paths.json\n*.heapsnapshot\npackager\nartifacts\n.edit"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 102485,
    "preview": "\n## 6.0.14\n\n- Fixed version of @pm2/pm2-version-check #6055\n- CVE-2025-64718 Update js-yaml\n- replace fs.R_OK with fs.co"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2809,
    "preview": "# Contributing\n\n## Cloning PM2 development\n\n```bash\n$ git clone https://github.com/Unitech/pm2.git\n$ cd pm2\n$ git checko"
  },
  {
    "path": "GNU-AGPL-3.0.txt",
    "chars": 34516,
    "preview": "\n                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C"
  },
  {
    "path": "LICENSE",
    "chars": 17,
    "preview": "GNU-AGPL-3.0.txt\n"
  },
  {
    "path": "README.md",
    "chars": 6460,
    "preview": "<div align=\"center\">\n <br/>\n\n![https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-logo-2.png](https://raw.git"
  },
  {
    "path": "bin/pm2",
    "chars": 56,
    "preview": "#!/usr/bin/env node\n\nrequire('../lib/binaries/CLI.js');\n"
  },
  {
    "path": "bin/pm2-dev",
    "chars": 59,
    "preview": "#!/usr/bin/env node\n\nrequire('../lib/binaries/DevCLI.js');\n"
  },
  {
    "path": "bin/pm2-docker",
    "chars": 67,
    "preview": "#!/usr/bin/env node\n\nrequire('../lib/binaries/Runtime4Docker.js');\n"
  },
  {
    "path": "bin/pm2-runtime",
    "chars": 67,
    "preview": "#!/usr/bin/env node\n\nrequire('../lib/binaries/Runtime4Docker.js');\n"
  },
  {
    "path": "bin/pm2-windows",
    "chars": 56,
    "preview": "#!/usr/bin/env node\n\nrequire('../lib/binaries/CLI.js');\n"
  },
  {
    "path": "bin/pm2.ps1",
    "chars": 90,
    "preview": "# pm2.ps1\n$pm2Path = Join-Path $PSScriptRoot \"../lib/binaries/CLI.js\"\nnode $pm2Path $args\n"
  },
  {
    "path": "constants.js",
    "chars": 5097,
    "preview": "/**\n * Copyright 2013-2022 the PM2 project authors. All rights reserved.\n * Use of this source code is governed by a lic"
  },
  {
    "path": "examples/api-pm2/README.md",
    "chars": 776,
    "preview": "\n# PM2 API\n\nHere is an example of the PM2 API:\n\n```\n$ node api.js\n```\n\nWill delete all apps, will start http.js, and res"
  },
  {
    "path": "examples/api-pm2/api.js",
    "chars": 531,
    "preview": "\n\nvar pm2 = require('../..');\n\npm2.delete('all', function(err) {\n  if (err) {\n    console.error(err);\n    return pm2.dis"
  },
  {
    "path": "examples/api-pm2/http.js",
    "chars": 241,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey')"
  },
  {
    "path": "examples/c-compile/hello.c",
    "chars": 133,
    "preview": "#include <stdio.h>\nint main()\n{\n  // printf() displays the string inside quotation\n  printf(\"Hello, Wss   asdsad!\\n\");\n "
  },
  {
    "path": "examples/cluster-http/README.md",
    "chars": 121,
    "preview": "\nTo start http application in cluster mode:\n\n```bash\n$ pm2 start ecosystem.config.js\n# OR\n$ pm2 start http.js -i max\n```"
  },
  {
    "path": "examples/cluster-http/ecosystem.config.js",
    "chars": 275,
    "preview": "module.exports = {\n  apps : [{\n    name   : 'clustered_http',\n    script : './http.js',\n    instances : 'max',\n    exec_"
  },
  {
    "path": "examples/cluster-http/http-no-exit.js",
    "chars": 285,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey')"
  },
  {
    "path": "examples/cluster-http/http.js",
    "chars": 258,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  console.log(`N"
  },
  {
    "path": "examples/cluster-tcp/README.md",
    "chars": 119,
    "preview": "\nTo start tcp application in cluster mode:\n\n```bash\n$ pm2 start ecosystem.config.js\n# OR\n$ pm2 start tcp.js -i max\n```\n"
  },
  {
    "path": "examples/cluster-tcp/http.js",
    "chars": 241,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey')"
  },
  {
    "path": "examples/cluster-tcp/process.config.js",
    "chars": 272,
    "preview": "module.exports = {\n  apps : [{\n    name   : 'clustered_tcp',\n    script : './tcp.js',\n    instances : 'max',\n    exec_mo"
  },
  {
    "path": "examples/cluster-tcp/tcp.js",
    "chars": 313,
    "preview": "var net = require('net');\n\nvar server = net.createServer(function (socket) {\n  socket.write('Welcome to the Telnet serve"
  },
  {
    "path": "examples/custom-nodejs-version/ecosystem.config.js",
    "chars": 277,
    "preview": "module.exports = {\n  /**\n   * Application configuration section\n   * http://pm2.keymetrics.io/docs/usage/application-dec"
  },
  {
    "path": "examples/custom-nodejs-version/http.js",
    "chars": 624,
    "preview": "\nvar http = require('http');\n\nconsole.log(process.version);\n\nvar server = http.createServer(function(req, res) {\n  res.w"
  },
  {
    "path": "examples/docker-pm2/Dockerfile",
    "chars": 268,
    "preview": "FROM keymetrics/pm2:latest-alpine\n\n# Bundle APP files\nCOPY ./app /app\nWORKDIR /app\n\n# Install app dependencies\nENV NPM_C"
  },
  {
    "path": "examples/docker-pm2/README.md",
    "chars": 332,
    "preview": "\nHere is an example on using pm2 inside container with the official image and pm2-runtime.\n\nTo build & run it:\n\n```bash\n"
  },
  {
    "path": "examples/docker-pm2/app/app.js",
    "chars": 187,
    "preview": "const express = require('express')\nconst app = express()\n\napp.get('/', (req, res) => res.send('Hello World!'))\n\napp.list"
  },
  {
    "path": "examples/docker-pm2/app/package.json",
    "chars": 249,
    "preview": "{\n  \"name\": \"app\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"E"
  },
  {
    "path": "examples/docker-pm2/app/process.config.js",
    "chars": 90,
    "preview": "module.exports = {\n  apps : [{\n    name   : \"express-app\",\n    script : \"./app.js\"\n  }]\n}\n"
  },
  {
    "path": "examples/echo/log.js",
    "chars": 119,
    "preview": "\n\nsetInterval(function() {\n  console.log('out');\n}, 1000);\n\nsetInterval(function() {\n  console.error('err');\n}, 1000);\n"
  },
  {
    "path": "examples/echo/stdout.js",
    "chars": 64,
    "preview": "\nsetInterval(function() {\n  process.stdout.write('ooo')\n}, 100)\n"
  },
  {
    "path": "examples/ecosystem-file/README.md",
    "chars": 432,
    "preview": "\nHere we have 3 applications (apps folder) that we can start with process file.\nThese process file can be of different f"
  },
  {
    "path": "examples/ecosystem-file/apps/connection_check.sh",
    "chars": 81,
    "preview": "#!/bin/bash\n\nfoo() {\n    echo \"Hello Bash!\"\n}\n\nwhile true; do foo; sleep 2; done\n"
  },
  {
    "path": "examples/ecosystem-file/apps/http.js",
    "chars": 276,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey')"
  },
  {
    "path": "examples/ecosystem-file/apps/worker.js",
    "chars": 132,
    "preview": "\nsetInterval(function() {\n  console.log('Worker has finished his job.');\n  console.error('Worker has finished his job.')"
  },
  {
    "path": "examples/ecosystem-file/process.config.js",
    "chars": 574,
    "preview": "module.exports = {\n  apps : [{\n    name               : 'HTTP-API',\n    script             : 'apps/http.js',\n    exec_mo"
  },
  {
    "path": "examples/ecosystem-file/process.json",
    "chars": 557,
    "preview": "{\n  apps : [{\n    name               : 'HTTP-API',\n    script             : 'apps/http.js',\n    exec_mode          : 'cl"
  },
  {
    "path": "examples/ecosystem-file/process.yml",
    "chars": 359,
    "preview": "apps:\n  - name : 'HTTP-API'\n    script: 'apps/http.js'\n    instances: 'max'\n    max_memory_restart: '260M'\n    watch : t"
  },
  {
    "path": "examples/esm/addTwo.js",
    "chars": 77,
    "preview": "// addTwo.mjs\nfunction addTwo(num) {\n  return num + 2;\n}\n\nexport { addTwo };\n"
  },
  {
    "path": "examples/esm/app.js",
    "chars": 88,
    "preview": "\n// app.mjs\nimport { addTwo } from './addTwo.js';\n\n// Prints: 6\nconsole.log(addTwo(4));\n"
  },
  {
    "path": "examples/esm/package.json",
    "chars": 220,
    "preview": "{\n  \"name\": \"esm\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"addTwo.js\",\n  \"type\": \"module\",\n  \"scripts\": {\n"
  },
  {
    "path": "examples/exception/fast.js",
    "chars": 52,
    "preview": "setTimeout(() => {\n  throw new Error('err')\n}, 100)\n"
  },
  {
    "path": "examples/exception/slow.js",
    "chars": 53,
    "preview": "setTimeout(() => {\n  throw new Error('err')\n}, 1500)\n"
  },
  {
    "path": "examples/expose-custom-metrics/README.md",
    "chars": 190,
    "preview": "\nTo expose custom metrics from your code and monitor it from CLI:\n\n```bash\n$ pm2 start process.config.js\n```\n\nThen to mo"
  },
  {
    "path": "examples/expose-custom-metrics/process-metrics.js",
    "chars": 577,
    "preview": "\nvar Probe = require('pmx').probe();\n\nvar i = 0;\n\nvar metric = Probe.metric({\n  name    : 'Metric',\n  value   : function"
  },
  {
    "path": "examples/expose-custom-metrics/process.config.js",
    "chars": 72,
    "preview": "module.exports = {\n  apps : [{\n    script : 'process-metrics.js'\n  }]\n}\n"
  },
  {
    "path": "examples/expose-triggerable-functions/index.js",
    "chars": 222,
    "preview": "\nvar pmx = require('pmx');\n\npmx.action('ping', function(reply) {\n  return reply({ 'pong' : 'hehe' })\n});\n\npmx.action('pa"
  },
  {
    "path": "examples/expose-triggerable-functions/process.yml",
    "chars": 50,
    "preview": "- script : './index.js'\n  name : 'custom-actions'\n"
  },
  {
    "path": "examples/expose-triggerable-functions/trigger-param.js",
    "chars": 225,
    "preview": "var pm2 = require('../..');\n\npm2.trigger('0', 'param', { some : 'data' }, function(err, res) {\n  var rep_1 = res[0];\n  c"
  },
  {
    "path": "examples/expose-triggerable-functions/trigger-ping.js",
    "chars": 205,
    "preview": "var pm2 = require('../..');\n\npm2.trigger('0', 'ping', function(err, res) {\n  var rep_1 = res[0];\n  console.log(`Got resu"
  },
  {
    "path": "examples/import/circle.js",
    "chars": 158,
    "preview": "const PI = 3.14159265359;\n\nexport function area(radius) {\n  return (radius ** 2) * PI;\n}\n\nexport function circumference("
  },
  {
    "path": "examples/import/index.js",
    "chars": 167,
    "preview": "import { area, circumference } from './circle.js';\n\nconst r = 3;\n\nconsole.log(`Circle with radius ${r} has\n  area: ${are"
  },
  {
    "path": "examples/import/package.json",
    "chars": 221,
    "preview": "{\n  \"name\": \"import\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"type\":\"module\",\n  \"scripts\": {"
  },
  {
    "path": "examples/interact-via-stdin/README.md",
    "chars": 120,
    "preview": "\nTo interact with an app readin on stdin:\n\n\n```\n$ pm2 start stdin.js\n```\n\nThen to attach to it:\n\n```\n$ pm2 attach 0\n```\n"
  },
  {
    "path": "examples/interact-via-stdin/stdin.js",
    "chars": 283,
    "preview": "\nconst readline = require('readline');\n\nconst rl = readline.createInterface({\n  input: process.stdin,\n  output: process."
  },
  {
    "path": "examples/misc-examples/001-test.js",
    "chars": 197,
    "preview": "\n\n\nsetInterval(function() {\n  console.log('log message from echo.js');\n}, 1500);\n\nsetTimeout(function() {\n  setInterval("
  },
  {
    "path": "examples/misc-examples/apps/all-pm2.json",
    "chars": 262,
    "preview": "[{\n  \"name\"      : \"echo\",\n  \"script\"    : \"./examples/echo.js\",\n  \"instances\" : \"1\"\n},{\n  \"name\"      : \"api\",\n  \"scrip"
  },
  {
    "path": "examples/misc-examples/apps/args.json",
    "chars": 171,
    "preview": "{\n  \"name\"      : \"echo\",\n  \"script\"    : \"./examples/args.js\",\n  \"instances\" : \"1\",\n  \"args\"      : \"['--toto=heya coco"
  },
  {
    "path": "examples/misc-examples/apps/auto-kill-echo.json",
    "chars": 82,
    "preview": "{\n  \"name\" : \"auto-kill\",\n  \"script\" : \"./examples/echokill.js\",\n  \"max\" : \"10\"\n}\n"
  },
  {
    "path": "examples/misc-examples/apps/cluster-pm2.json",
    "chars": 191,
    "preview": "{\n  \"script\" : \"./examples/child.js\",\n  \"error_file\" : \"errLog.log\",\n  \"out_file\" : \"outLog.log\",\n  \"pid_file\" : \"child\""
  },
  {
    "path": "examples/misc-examples/apps/cron-pm2.json",
    "chars": 171,
    "preview": "{\n  \"name\"      : \"echo\",\n  \"script\"    : \"./examples/args.js\",\n  \"instances\" : \"1\",\n  \"args\"      : \"['--toto=heya coco"
  },
  {
    "path": "examples/misc-examples/apps/default-path-echo.json",
    "chars": 78,
    "preview": "{\n  \"name\" : \"echo-default\",\n  \"script\" : \"examples/echo.js\",\n  \"max\" : \"1\"\n}\n"
  },
  {
    "path": "examples/misc-examples/apps/echo-pm2.json",
    "chars": 235,
    "preview": "{\n  \"script\" : \"examples/echo.js\",\n  \"error_file\" : \"errEcho.log\",\n  \"out_file\" : \"outEcho.log\",\n  \"name\" : \"ok\",\n  \"pid"
  },
  {
    "path": "examples/misc-examples/apps/env-pm2.json",
    "chars": 294,
    "preview": "{\n  \"script\" : \"examples/env.js\",\n  \"error_file\" : \"errEcho.log\",\n  \"out_file\" : \"outEcho.log\",\n  \"name\" : \"ok\",\n  \"pid_"
  },
  {
    "path": "examples/misc-examples/apps/killfast.json",
    "chars": 116,
    "preview": "{\n  \"min_uptime\" : \"100\",\n  \"max_restarts\" : \"400\",\n  \"name\" : \"auto-kill\",\n  \"script\" : \"./examples/killfast.js\"\n}\n"
  },
  {
    "path": "examples/misc-examples/apps/multi-pm2.json",
    "chars": 173,
    "preview": "[{\n  \"name\"      : \"echo\",\n  \"script\"    : \"./examples/args.js\",\n  \"instances\" : \"1\",\n  \"args\"      : \"['--toto=heya coc"
  },
  {
    "path": "examples/misc-examples/apps/no-name-echo.json",
    "chars": 51,
    "preview": "{\n  \"script\" : \"examples/echo.js\",\n  \"max\" : \"1\"\n}\n"
  },
  {
    "path": "examples/misc-examples/args.js",
    "chars": 226,
    "preview": "\nprocess.argv.forEach(function (val, index, array) {\n  console.log(index + ': ' + val);\n});\n\nconsole.log('Argv2 = ', pro"
  },
  {
    "path": "examples/misc-examples/auto-restart-all.js",
    "chars": 185,
    "preview": "\n\n\nvar pm2 = require('..');\n\nsetTimeout(function() {\n  pm2.connect(function() {\n    pm2.restart('all', function() {\n    "
  },
  {
    "path": "examples/misc-examples/auto-restart-threshold.js",
    "chars": 380,
    "preview": "var pmx = require('pmx');\n\nvar Probe = pmx.probe();\n\nvar i = 0;\n\nvar val = Probe.metric({\n  name : 'test',\n  value : fun"
  },
  {
    "path": "examples/misc-examples/auto-save.js",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "examples/misc-examples/beforeExit.js",
    "chars": 328,
    "preview": "\nvar stopped = false;\n\nfunction work() {\n  console.log('working');\n  !stopped && setTimeout(work, 1000);\n}\n\nfunction sto"
  },
  {
    "path": "examples/misc-examples/child-echo.json",
    "chars": 353,
    "preview": "{\n  \"apps\" : [{\n    \"script\":\"examples/child.js\",\n    \"name\":\"API-web\",\n    \"instances\":3\n  },{\n    \"script\":\"examples/e"
  },
  {
    "path": "examples/misc-examples/child-env.js",
    "chars": 157,
    "preview": "\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end(process.env.PORT_EN"
  },
  {
    "path": "examples/misc-examples/child-pm2.json",
    "chars": 161,
    "preview": "{\n  \"script\":\"examples/child.js\",\n  \"name\":\"SERVERONE\",\n  \"instances\":10,\n  \"error_file\":\"errfile.log\",\n  \"out_file\":\"ou"
  },
  {
    "path": "examples/misc-examples/child.js",
    "chars": 276,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey')"
  },
  {
    "path": "examples/misc-examples/child.js-pm2.json",
    "chars": 56,
    "preview": "{\n  \"script\":\"examples/child.js\",\n  \"name\":\"child.js\"\n}\n"
  },
  {
    "path": "examples/misc-examples/child2.js",
    "chars": 164,
    "preview": "\nvar axm = require('pmx');\naxm.http();\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n  res.writeHe"
  },
  {
    "path": "examples/misc-examples/client.js",
    "chars": 1378,
    "preview": "\n\nvar Wrap = require('./wrap.js');\nvar axon = require('pm2-axon');\n\nvar Module = require('module');\nWrap.wrap(Module, '_"
  },
  {
    "path": "examples/misc-examples/cwd.js",
    "chars": 137,
    "preview": "\n\nconsole.log(process.env.PWD);\nconsole.log(process.cwd());\nconsole.log(__dirname);\n\nrequire('./echo.js');\n\nconsole.log("
  },
  {
    "path": "examples/misc-examples/echo.coffee",
    "chars": 61,
    "preview": "#!/usr/bin/env coffee\n\nsetInterval (-> console.log 'ok'), 500"
  },
  {
    "path": "examples/misc-examples/echo.js",
    "chars": 229,
    "preview": "\n\nsetInterval(function() {\n  console.log('log message from echo.js');\n  console.warn({ json : true });\n}, 1500);\n\nsetTim"
  },
  {
    "path": "examples/misc-examples/echokill.js",
    "chars": 192,
    "preview": "\n\nsetInterval(function() {\n  console.log('log message from echo auto kill');\n}, 800);\n\nsetTimeout(function() {\n  console"
  },
  {
    "path": "examples/misc-examples/env.js",
    "chars": 91,
    "preview": "setInterval(function() {\n  console.log('env NODE_ENV = ', process.env.NODE_ENV);\n}, 1000);\n"
  },
  {
    "path": "examples/misc-examples/env_args.js",
    "chars": 43,
    "preview": "\nconsole.log(process.env.PASSED_VARIABLE);\n"
  },
  {
    "path": "examples/misc-examples/exec_watch.json",
    "chars": 181,
    "preview": "[{\n  \"script\":\"examples/child.js\",\n  \"name\":\"SERVERONE\",\n  \"instances\":10,\n  \"watch\" : true,\n  \"error_file\":\"errfile.log"
  },
  {
    "path": "examples/misc-examples/exit.js",
    "chars": 529,
    "preview": "\n// process.on('exit', function() {\n//   console.log('About to exit.');\n// });\n\n// process.on('uncaughtException', funct"
  },
  {
    "path": "examples/misc-examples/expose_method.js",
    "chars": 303,
    "preview": "\n/*\n * Example of usage : https://github.com/Unitech/pm2/pull/214\n */\nprocess.on(\"message\", function (msg) {\n  console.l"
  },
  {
    "path": "examples/misc-examples/graceful-exit.js",
    "chars": 488,
    "preview": "\n/*\n * Example of graceful exit\n *\n * $ pm2 reload all\n */\n\nprocess.on('message', function(msg) {\n  if (msg == 'shutdown"
  },
  {
    "path": "examples/misc-examples/harmony.js",
    "chars": 153,
    "preview": "var assert = require('assert')\n  , s = new Set()\n  ;\n\ns.add('a');\n\nassert.ok(s.has('a'));\n\nsetInterval(function() {\n  co"
  },
  {
    "path": "examples/misc-examples/http.js",
    "chars": 1280,
    "preview": "\nvar pmx = require('pmx');\nvar conf = pmx.init({\n  http: true\n});\n\nvar http = require('http');\n\nhttp.createServer(functi"
  },
  {
    "path": "examples/misc-examples/infinite-recurse.js",
    "chars": 29,
    "preview": "function x() {\n  x();\n}\nx();\n"
  },
  {
    "path": "examples/misc-examples/inside.js",
    "chars": 170,
    "preview": "\nvar pm2 = require('..');\n\npm2.connect(function() {\n  setInterval(function() {\n    pm2.restart('echo', function() {\n    "
  },
  {
    "path": "examples/misc-examples/inside.json",
    "chars": 113,
    "preview": "\n[{\n  \"name\" : \"inside\",\n  \"script\":\"examples/inside.js\"\n},{\n  \"name\" : \"echo\",\n  \"script\":\"examples/echo.js\"\n}]\n"
  },
  {
    "path": "examples/misc-examples/interact.js",
    "chars": 350,
    "preview": "\nvar pm2 = require('..');\n\nvar MACHINE_NAME = 'hk1';\nvar PRIVATE_KEY  = 'z1ormi95vomgq66';\nvar PUBLIC_KEY   = 'oa0m7nuhd"
  },
  {
    "path": "examples/misc-examples/json.js",
    "chars": 175,
    "preview": "\nsetInterval(function() {\n  console.log({\n    hey : 'hay',\n    ho : {\n      si : 'si',\n      ca : ['boum']\n    }\n  });\n "
  },
  {
    "path": "examples/misc-examples/kill-not-so-fast.js",
    "chars": 132,
    "preview": "\nconsole.log('start');\n\nsetTimeout(function() {\n  console.log('exit');\n  throw new Error('Exitasdsadasdsda unacepted !!'"
  },
  {
    "path": "examples/misc-examples/kill-slow.js",
    "chars": 77,
    "preview": "\nsetTimeout(function() {\n  console.log('exit');\n  process.exit(1);\n}, 1000);\n"
  },
  {
    "path": "examples/misc-examples/killfast.js",
    "chars": 18,
    "preview": "\nprocess.exit(1);\n"
  },
  {
    "path": "examples/misc-examples/killslow.js",
    "chars": 61,
    "preview": "\n\nsetTimeout(function() {\n  throw new Error('ok');\n}, 1100);\n"
  },
  {
    "path": "examples/misc-examples/killtoofast.js",
    "chars": 107,
    "preview": "\nconsole.log('im a kamikazy');\n\nsetInterval(function() {\n  console.log('BOUM');\n  process.exit(1);\n}, 30);\n"
  },
  {
    "path": "examples/misc-examples/leak.js",
    "chars": 169,
    "preview": "\nvar leak = [];\n\nsetInterval(function() {\n  for (var i = 0; i < 10; i++) {\n    var str = i.toString() + \" on a stick, sh"
  },
  {
    "path": "examples/misc-examples/malformated.json",
    "chars": 496,
    "preview": "{\n  \"apps\" : [{\n    \"exec_interpreter\"   : \"node,\n    \"exec_mode\"          : \"cluster_mode\",\n    \"instances\"          : "
  },
  {
    "path": "examples/misc-examples/modulechild.js",
    "chars": 30,
    "preview": "\n\nconsole.log(module.parent);\n"
  },
  {
    "path": "examples/misc-examples/moduleparent.js",
    "chars": 68,
    "preview": "\n\nvar a =require('./modulechild.js');\nconsole.log(module.children);\n"
  },
  {
    "path": "examples/misc-examples/null.js",
    "chars": 372,
    "preview": "var pmx = require('pmx');\nvar http  = require('http');\n\nhttp.createServer(function(req, res) {\n      res.end('Thanks');\n"
  },
  {
    "path": "examples/misc-examples/package.json",
    "chars": 436,
    "preview": "{\n  \"name\": \"example-module\",\n  \"version\": \"0.3.21\",\n  \"description\": \"Keymetrics++ and PM2 adapter\",\n  \"main\": \"scoped-"
  },
  {
    "path": "examples/misc-examples/process.json",
    "chars": 603,
    "preview": "{\n  \"apps\" : [{\n    \"exec_interpreter\"   : \"node\",\n    \"exec_mode\"          : \"cluster_mode\",\n    \"instances\"          :"
  },
  {
    "path": "examples/misc-examples/programmatic.js",
    "chars": 642,
    "preview": "\nvar pm2 = require('..');\n\npm2.connect(function() {\n\n  pm2.start('echo.js', function() {\n\n    setInterval(function() {\n "
  },
  {
    "path": "examples/misc-examples/require.js",
    "chars": 151,
    "preview": "\nvar util = require('util');\n\nconsole.log(util.inspect(require.main));\nsetInterval(function() {\n  console.log(util.inspe"
  },
  {
    "path": "examples/misc-examples/sendmsg.js",
    "chars": 131,
    "preview": "\nsetInterval(function() {\n  process.send({\n    type : 'miami',\n    data : { msg : 'i can communicate with others'}\n  });"
  },
  {
    "path": "examples/misc-examples/sigint.js",
    "chars": 129,
    "preview": "\nprocess.on('SIGINT', function() {\n  // Do othing for tests\n});\n\nsetInterval(function() {\n  console.log('I\\'m alive');\n}"
  },
  {
    "path": "examples/misc-examples/start-args.js",
    "chars": 201,
    "preview": "\n\nvar pm2 = require('..');\n\npm2.connect(function() {\n  pm2.start(__dirname + '/args.js', {\n    scriptArgs : ['-i', 'sisi"
  },
  {
    "path": "examples/misc-examples/stop-after5.js",
    "chars": 54,
    "preview": "\nsetTimeout(function() {\n  process.exit(0);\n}, 5000);\n"
  },
  {
    "path": "examples/misc-examples/string-crash.js",
    "chars": 51,
    "preview": "\nfunction crash() {\n  throw 'crashed';\n}\n\ncrash();\n"
  },
  {
    "path": "examples/misc-examples/throw.js",
    "chars": 88,
    "preview": "\nsetTimeout(function() {\n  throw new Error('New error thrown automatically');\n}, 1200);\n"
  },
  {
    "path": "examples/misc-examples/tree.js",
    "chars": 303,
    "preview": "\nvar spawn = require('child_process').spawn,\n    grep  = spawn('top', [], { stdio: 'inherit' });\n\n\nvar http = require('h"
  },
  {
    "path": "examples/misc-examples/udp.js",
    "chars": 462,
    "preview": "\n\n\nvar punt = require('punt');\nvar server = punt.bind('0.0.0.0:5000');\nvar a = punt.connect('0.0.0.0:5000');\nvar b = pun"
  },
  {
    "path": "examples/misc-examples/wrap.js",
    "chars": 823,
    "preview": "\nvar debug = require('debug')('methods');\n\nvar Proxy = module.exports = {\n  wrap : function(object, methods, hook) {\n   "
  },
  {
    "path": "examples/module-extra-meta/index.js",
    "chars": 384,
    "preview": "\nvar pmx = require('pmx');\n\n/**\n * set \"PM2_WAIT_FOR_INIT\" : TIME to tell PM2 to show human infos\n */\npmx.configureModul"
  },
  {
    "path": "examples/module-extra-meta/package.json",
    "chars": 306,
    "preview": "{\n  \"name\": \"init-module\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \""
  },
  {
    "path": "examples/module-test/README.md",
    "chars": 959,
    "preview": "\nThis is a sample module that have been generate via `pm2 module:generate`:\n\n```\n>>> pm2 module:generate\n[PM2] Spawning "
  },
  {
    "path": "examples/module-test/app.js",
    "chars": 3523,
    "preview": "\nvar pmx = require('pmx');\n\n/******************************\n *    ______ _______ ______\n *   |   __ \\   |   |__    |\n * "
  },
  {
    "path": "examples/module-test/package.json",
    "chars": 482,
    "preview": "{\n  \"name\": \"module-test\",\n  \"version\": \"1.0.0\",\n  \"description\": \"PM2 Sample Module\",\n  \"main\": \"app.js\",\n  \"dependenci"
  },
  {
    "path": "examples/npm-start/http.js",
    "chars": 241,
    "preview": "\nvar http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey')"
  },
  {
    "path": "examples/npm-start/package.json",
    "chars": 234,
    "preview": "{\n  \"name\": \"npm-start\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"ec"
  },
  {
    "path": "examples/pmx-test-all/elements/cluster.js",
    "chars": 1025,
    "preview": "\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n  res.writeHead(200);\n  setTimeout(function() {\n   "
  },
  {
    "path": "examples/pmx-test-all/elements/counter.js",
    "chars": 163,
    "preview": "\n\nconst pmx = require('pmx');\nconst Probe = pmx.probe();\n\nvar metric = Probe.counter({\n  name    : 'Counter'\n});\n\nsetInt"
  },
  {
    "path": "examples/pmx-test-all/elements/error.js",
    "chars": 55,
    "preview": "\nsetInterval(function() {\n  new Error('toto');\n}, 10);\n"
  },
  {
    "path": "examples/pmx-test-all/elements/event.js",
    "chars": 164,
    "preview": "\nconst pmx = require('pmx');\n\nsetInterval(function() {\n  pmx.emit('user:register', {\n    user : 'Alex registered',\n    e"
  },
  {
    "path": "examples/pmx-test-all/elements/histogram.js",
    "chars": 237,
    "preview": "\n\nconst pmx = require('pmx');\nconst Probe = pmx.probe();\n\nvar metric = Probe.histogram({\n  name    : 'Histogram'\n});\n\nva"
  },
  {
    "path": "examples/pmx-test-all/elements/http.js",
    "chars": 1025,
    "preview": "\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n  res.writeHead(200);\n  setTimeout(function() {\n   "
  },
  {
    "path": "examples/pmx-test-all/elements/log-cluster.js",
    "chars": 80,
    "preview": "setInterval(function() {\n  console.log('log');\n  console.error('log');\n}, 200);\n"
  },
  {
    "path": "examples/pmx-test-all/elements/log.js",
    "chars": 81,
    "preview": "\nsetInterval(function() {\n  console.log('log');\n  console.error('log');\n}, 200);\n"
  },
  {
    "path": "examples/pmx-test-all/elements/meter.js",
    "chars": 159,
    "preview": "\nconst pmx = require('pmx');\nconst Probe = pmx.probe();\n\nvar metric = Probe.meter({\n  name    : 'Meter'\n});\n\nsetInterval"
  },
  {
    "path": "examples/pmx-test-all/elements/metric.js",
    "chars": 239,
    "preview": "\nconst pmx = require('pmx');\nconst Probe = pmx.probe();\n\nvar data = 10;\n\nvar metric = Probe.metric({\n  name    : 'Realti"
  },
  {
    "path": "examples/pmx-test-all/elements/notify.js",
    "chars": 99,
    "preview": "\nconst pmx = require('pmx');\n\nsetInterval(function() {\n  pmx.notify({ success : false });\n}, 200);\n"
  },
  {
    "path": "examples/pmx-test-all/elements/trace.js",
    "chars": 1005,
    "preview": "\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n  res.writeHead(200);\n  setTimeout(function() {\n   "
  },
  {
    "path": "examples/pmx-test-all/process.config.js",
    "chars": 640,
    "preview": "module.exports = {\n  pm2 : [{\n    script : './elements/error.js'\n  }, {\n    script : './elements/metric.js'\n  }, {\n    s"
  },
  {
    "path": "examples/run-php-python-ruby-bash/bashscript.sh",
    "chars": 43,
    "preview": "while true; do\n    ls -l\n    sleep 5\ndone\n\n"
  },
  {
    "path": "examples/run-php-python-ruby-bash/echo.php",
    "chars": 68,
    "preview": "<?php\n\nwhile (1) {\n    echo 'lol i hate php !';\n    sleep(1);\n}\n\n ?>"
  },
  {
    "path": "examples/run-php-python-ruby-bash/echo.py",
    "chars": 122,
    "preview": "#!/usr/bin/python\nimport time\n\nwhile 1:\n    print(\"Start : %s\" % time.ctime())\n    print(\"second line\")\n    time.sleep(1"
  },
  {
    "path": "examples/run-php-python-ruby-bash/echo.rb",
    "chars": 39,
    "preview": "\nwhile 1 do\n  puts \"lol\"\n  sleep 1\nend\n"
  },
  {
    "path": "examples/run-php-python-ruby-bash/leak-mem.py",
    "chars": 4850,
    "preview": "#!/usr/bin/env python3\n\"\"\"\nmemory_leak.py\n\nStarts with sensible defaults if no CLI args are provided.\nUsage:\n  python3 m"
  },
  {
    "path": "examples/run-php-python-ruby-bash/process.yml",
    "chars": 214,
    "preview": "apps:\n  - script : './bashscript.sh'\n    name : 'bash-script'\n  - script : './echo.php'\n    name : 'php-script'\n  - scri"
  },
  {
    "path": "examples/send-msg/pm2-app.js",
    "chars": 135,
    "preview": "\nprocess.on('message', function(packet) {\n  process.send({\n    type : 'process:msg',\n    data : {\n      success : true\n "
  },
  {
    "path": "examples/send-msg/pm2-msg.js",
    "chars": 559,
    "preview": "\nconst pm2 = require('../..')\n\nconsole.log(pm2)\n\npm2.connect(function() {\n  pm2.sendDataToProcessId({\n    // id of procc"
  },
  {
    "path": "examples/send-msg/t2.js",
    "chars": 305,
    "preview": "\nvar tx2 = require('tx2')\nvar http = require('http')\n\nvar meter = tx2.meter({\n  name      : 'req/sec',\n  samples   : 1,\n"
  },
  {
    "path": "examples/signal-catching/graceful-http.js",
    "chars": 408,
    "preview": "\nvar http = require('http');\n\nprocess.on('SIGINT', function() {\n  console.log('Graceful closing...');\n  server.close(fun"
  },
  {
    "path": "examples/sourcemap-auto-resolve/API.js",
    "chars": 47851,
    "preview": "/**\n * Copyright 2013-2022 the PM2 project authors. All rights reserved.\n * Use of this source code is governed by a lic"
  },
  {
    "path": "examples/sourcemap-auto-resolve/README.md",
    "chars": 1606,
    "preview": "\nHere is a source map support demo.\nSource map are automatically handled by pm2:\n\n```bash\n$ pm2 start process.config.js\n"
  },
  {
    "path": "examples/sourcemap-auto-resolve/process.config.js",
    "chars": 93,
    "preview": "module.exports = {\n  apps : [{\n    name   : \"API-minified\",\n    script : \"API.min.js\"\n  }]\n}\n"
  },
  {
    "path": "examples/start-a-binary/ls.yml",
    "chars": 26,
    "preview": "apps:\n  - script : './ls'\n"
  },
  {
    "path": "examples/test-all-keymetrics-features/README.md",
    "chars": 190,
    "preview": "\nTry all features of Keymetrics:\n\n```bash\n# Make sure you've created keymetrics account\n$ pm2 register\n# Start all appli"
  },
  {
    "path": "examples/test-all-keymetrics-features/actions-fibonacci.js",
    "chars": 947,
    "preview": "\nvar stop = false;\n\n/**\n * Description\n * @method add\n * @param {} a\n * @param {} b\n * @return sum\n */\nfunction add(a, b"
  },
  {
    "path": "examples/test-all-keymetrics-features/custom_action.js",
    "chars": 359,
    "preview": "\nvar axm = require('@pm2/io');\n\naxm.action('getEnv', function(reply) {\n  reply(process.env);\n});\n\naxm.action('sayHello',"
  },
  {
    "path": "examples/test-all-keymetrics-features/custom_action_with_params.js",
    "chars": 578,
    "preview": "\nvar axm = require('@pm2/io');\n\naxm.action('refresh:db', { comment : 'Refresh the database' }, function(reply) {\n  conso"
  },
  {
    "path": "examples/test-all-keymetrics-features/event.js",
    "chars": 183,
    "preview": "\nvar axm = require('@pm2/io');\n\nsetInterval(function() {\n\n  axm.emit('content:page:created', {\n    msg : 'A CMS page has"
  },
  {
    "path": "examples/test-all-keymetrics-features/http_app.js",
    "chars": 1191,
    "preview": "\n\nvar io = require('@pm2/io').init({ http : true });\nvar probe = io.probe();\n\nvar http  = require('http');\n\n/**\n * Probe"
  },
  {
    "path": "examples/test-all-keymetrics-features/http_transaction.js",
    "chars": 1198,
    "preview": "\n\nvar axm = require('@pm2/io');\n\nvar probe = axm.probe();\n\nvar http = require('http');\n\nvar meter = probe.meter({\n  name"
  },
  {
    "path": "examples/test-all-keymetrics-features/pm2_probe.js",
    "chars": 834,
    "preview": "var io     = require('@pm2/io');\nvar pm2     = require('../..');\nvar fs      = require('fs');\nvar path    = require('pat"
  },
  {
    "path": "examples/test-all-keymetrics-features/probes.js",
    "chars": 1880,
    "preview": "\n\nvar io = require('@pm2/io');\n\nvar users = {\n  'alex'  : 'ok',\n  'musta' : 'fa'\n};\n\n/**\n * Monitor synchronous return o"
  },
  {
    "path": "examples/test-all-keymetrics-features/process-load.config.js",
    "chars": 135,
    "preview": "module.exports = {\n  pm2 : [{\n    script : \"http_app.js\",\n    instances : 10\n  }, {\n    script : \"throw.js\",\n    instanc"
  },
  {
    "path": "examples/test-all-keymetrics-features/process-transpose.js",
    "chars": 350,
    "preview": "\nvar Probe = require('@pm2/io').probe();\n\nvar counter = 0;\n\n// var metric = Probe.transpose({\n//   name : 'data-flow',\n/"
  },
  {
    "path": "examples/test-all-keymetrics-features/process.config.js",
    "chars": 495,
    "preview": "module.exports = {\n  \"pm2\" : [{\n    \"script\" : \"pm2_probe.js\"\n  }, {\n    \"script\" : \"event.js\"\n  }, {\n    \"script\" : \"ht"
  },
  {
    "path": "examples/test-all-keymetrics-features/scoped-actions.js",
    "chars": 474,
    "preview": "\nvar io = require('@pm2/io');\n\nio.scopedAction('simple test', function(data, emitter) {\n  var i = setInterval(function()"
  },
  {
    "path": "examples/test-all-keymetrics-features/test-threshold.js",
    "chars": 1197,
    "preview": "\nvar axm = require('@pm2/io');\n\n\nvar users = 55\nvar battery = 80\n\nvar door = 0\nvar door_2 = 0\n\naxm.action('tozero', func"
  },
  {
    "path": "examples/test-all-keymetrics-features/throw.js",
    "chars": 175,
    "preview": "\nvar axm = require('@pm2/io');\n\nsetTimeout(function() {\n  console.log('log message from echo auto kill');\n  throw new Er"
  },
  {
    "path": "examples/treekill/app.js",
    "chars": 745,
    "preview": "\nconst spawn = require('child_process').spawn\nvar fs = require('fs');\n\nsetTimeout(function() {\n  daemonize('pm2 ls --wat"
  },
  {
    "path": "examples/treekill/process.json",
    "chars": 69,
    "preview": "{\n  \"apps\" : {\n    \"treekill\" : false,\n    \"script\" : \"app.js\"\n  }\n}\n"
  },
  {
    "path": "examples/udp/client.js",
    "chars": 860,
    "preview": "var udp = require('dgram');\n\n// -------------------- udp client ----------------\n\nvar buffer = require('buffer');\n\n// cr"
  },
  {
    "path": "examples/udp/server.js",
    "chars": 1193,
    "preview": "var udp = require('dgram');\n\n// --------------------creating a udp server --------------------\n\n// creating a udp server"
  },
  {
    "path": "examples/using-pm2-and-transpilers/README.md",
    "chars": 218,
    "preview": "\n## Coffee Script\n\n```\n$ pm2 install coffee-script\n$ pm2 start echo.coffee\n```\n\n## Typescript\n\n```\n$ pm2 install typescr"
  },
  {
    "path": "examples/using-pm2-and-transpilers/echo.coffee",
    "chars": 61,
    "preview": "#!/usr/bin/env coffee\n\nsetInterval (-> console.log 'ok'), 500"
  },
  {
    "path": "examples/using-pm2-and-transpilers/echo.ls",
    "chars": 58,
    "preview": "#!/usr/bin/env lsc\n\nsetInterval (-> console.log 'ok'), 500"
  },
  {
    "path": "examples/using-pm2-and-transpilers/echo.ts",
    "chars": 200,
    "preview": "\nclass Greeter {\n  constructor(public greeting: string) { }\n  greet() {\n    return \"<h1>\" + this.greeting + \"</h1>\";\n  }"
  },
  {
    "path": "examples/using-pm2-and-transpilers/http.ts",
    "chars": 665,
    "preview": "/// <reference path=\"./node.d.ts\" />\n\n/**\n * See the node.js TypeScript definition needed for this\n * example here: http"
  },
  {
    "path": "examples/using-pm2-and-transpilers/node.d.ts",
    "chars": 110836,
    "preview": "// Type definitions for Node.js v6.x\n// Project: http://nodejs.org/\n// Definitions by: Microsoft TypeScript <http://type"
  },
  {
    "path": "examples/wait-ready/app.js",
    "chars": 415,
    "preview": "const http = require('http');\n\nprocess.on('SIGINT', (msg) => {\n  console.log('Just got SIGINTed, but I dont care');\n  pr"
  },
  {
    "path": "examples/wait-ready/ecosystem.json",
    "chars": 191,
    "preview": "{\n  \"apps\": [{\n    \"name\": \"app\",\n    \"script\": \"app.js\",\n    \"instances\": 2,\n    \"exec_mode\": \"cluster\",\n    \"wait_read"
  },
  {
    "path": "examples/wait-ready/http-simple.js",
    "chars": 592,
    "preview": "var http = require('http');\n\nvar server = http.createServer(function(req, res) {\n  res.writeHead(200);\n  res.end('hey');"
  },
  {
    "path": "index.js",
    "chars": 303,
    "preview": "/**\n * Copyright 2013-2022 the PM2 project authors. All rights reserved.\n * Use of this source code is governed by a lic"
  },
  {
    "path": "lib/API/Configuration.js",
    "chars": 6316,
    "preview": "\nvar Common               = require('../Common.js');\nvar cst                  = require('../../constants.js');\nvar UX   "
  },
  {
    "path": "lib/API/Containerizer.js",
    "chars": 11162,
    "preview": "\nvar spawn   = require('child_process').spawn;\nvar exec    = require('child_process').exec;\nvar chalk   = require('ansis"
  },
  {
    "path": "lib/API/Dashboard.js",
    "chars": 12060,
    "preview": "/**\n * Copyright 2013-2022 the PM2 project authors. All rights reserved.\n * Use of this source code is governed by a lic"
  },
  {
    "path": "lib/API/Deploy.js",
    "chars": 4333,
    "preview": "/**\n * Copyright 2013-2022 the PM2 project authors. All rights reserved.\n * Use of this source code is governed by a lic"
  },
  {
    "path": "lib/API/Extra.js",
    "chars": 22268,
    "preview": "\n/***************************\n *\n * Extra methods\n *\n **************************/\n\nvar cst         = require('../../cons"
  },
  {
    "path": "lib/API/ExtraMgmt/Docker.js",
    "chars": 874,
    "preview": "\nconst util = require('util')\nconst spawn = require('child_process').spawn\nconst DockerMgmt = {}\n\nmodule.exports = Docke"
  }
]

// ... and 491 more files (download for full content)

About this extraction

This page contains the full source code of the Unitech/pm2 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 691 files (1.3 MB), approximately 392.0k tokens, and a symbol index with 442 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!