3

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?

lazlojuly
  • 829
  • 2
  • 8
  • 19
Pierre
  • 123
  • 2
  • 8

2 Answers2

11

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

lazlojuly
  • 829
  • 2
  • 8
  • 19
0

Go to your server directory and use the following commands:

pm2 start <your_app_name.js>
pm2 startup ubuntu
pm2 save
Tunaki
  • 132,869
  • 46
  • 340
  • 423
Ashish Gupta
  • 1,153
  • 12
  • 14