PM2 is an advanced process manager for for Node.JS application to keep an application running. In this article, we’ll discuss installation and various PM2 commands helpful in managing our Node.JS processes.
- PM2 can be installed using npm package manager,
sudo npm install -g pm2.
- To enable auto start at boot,
pm2 startupand follow the on-screen instructions.
- For more related PM2 commands, visit the Miscellaneous PM2 Commands section below.
Miscellaneous PM2 Commands:
- Check status of all running process
- Stop running PM2 at startup
- Check logs for a specific PM2 process
pm2 logging 0. Where 0 is the id of first process. ID can be obtained using
- If PM2 processes do not load at startup, use
pm2 resurrectcommand to bring them back.
- Restart all processes at once
pm2 restart all.
- Removing a process from PM2
pm2 delete 0. Where 0 is the id of first process. ID can be obtained using