How to make PM2 automatically startup on Linux/Mac OS environments?

As I explained in my previous post, pm2 default startup feature that very easy to configure with Linux and Mac OS environments. You just need to execute the 2 short commands in the terminal.

First, please install and start the pm2 and your node.js application in your system using npm if you haven’t done yet.

npm install pm2@latest -g i
pm2 start server.js -o ./logs/trace.log

Then you need to generate the startup script to type this command:
pm2 startup

Now, need to save your current process list to automatically start when system reboot and that is important.
pm2 save

That’s it. I hope this will help. 🙂
Photo: https://www.brandeps.com

Leave a Reply

Your email address will not be published. Required fields are marked *