PM2 will keep your application forever alive, auto-restarting across crashes and machine restarts.
The start script sets up PM2 as a service under the init system. When the server restarts, it will automatically restart PM2, which will then restart all the Node. js applications/processes it is managing. In this article, we will show you how to deploy PM2 as a service to reliably manage your Node.
With reload, pm2 restarts all processes one by one, always keeping at least one process running. It also states that: If the reload system hasn't managed to reload your application, a timeout will fallback to a classic restart.
I am currently programming Node.js with Express.js, and every time I change a line of code in the file router or app, I need to type the command:
pm2 reload id_project.
How do I make pm2 auto-reload the project when a file is changed?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With