Node.js Process Manager (pm2)
Installation
npm install pm2@latest -g yarn global add pm2To install Node.js and NPM you can use NVM
Start an app
The simplest way to start, daemonize and monitor your application is by using this command line:
pm2 start app.jsOr start any other application easily
pm2 start bashscript.shpm2 start python-app.py --watchpm2 start binary-file -- --port 1520Managing processes
Managing application state is simple here are the commands:
restart
pm2 restart app_namereload
pm2 reload app_namestop
pm2 stop app_namedelete
pm2 delete app_nameInstead of app_name you can pass:
- all to act on all processes
- id to act on a specific process id
Check status, logs, metrics
Now that you have started this application, you can check its status, logs, metrics and even get the online dashboard with pm2.io.
List managed applications
List the status of all application managed by PM2:
pm2 [list|ls|status]Terminal Based Dashboard
Here is a realtime dashboard that fits directly into your terminal:
pm2 monit