Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start Node JS application when server reboots with pm2

I am trying to use the module pm2 to start my node js app everytime the server boots. I have used the command pm2 startup ubuntu but each time I restart the server, my application is not running and I have to start it manually again.

Any ideas what is causing this issue?

like image 988
Pierre Avatar asked Feb 19 '26 17:02

Pierre


1 Answers

Make sure you do save your processes:

pm2 start app.js 
pm2 startup ubuntu 
pm2 save

Once you have started the apps and want to keep them on server reboot do: pm2 save

Source: https://github.com/Unitech/PM2/blob/master/ADVANCED_README.md#startup-script

like image 59
lazlojuly Avatar answered Feb 21 '26 09:02

lazlojuly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!