Auto Start pm2 on boot
To auto start pm2 on boot, run
1 |
pm2 startup |
This will generate auto start script for your system.
Once you started all applications, you can save it with
1 |
pm2 save |
To uninstall, run
1 |
pm2 unstartup systemd |
Running Application as Normal User
First login as the user, then start the application using pm2.
1 |
pm2 start app.js |
Now save it.
1 |
pm2 save |
Generate command for auto startup
1 |
pm2 startup |
It will show a command. That you need to run as user root. If you have sudo privilage, you can run it with sudo as same user.
This will create a service with name pm2-USERNAME.
After reboot, you will be able to check status with command
1 |
systemctl status pm2-USERNAME |
See pm2