To auto start pm2 on boot, run
pm2 startup
This will generate auto start script for your system.
Once you started all applications, you can save it with
pm2 save
To uninstall, run
pm2 unstartup systemd
Running Application as Normal User
First login as the user, then start the application using pm2.
pm2 start app.js
Now save it.
pm2 save
Generate command for auto startup
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
systemctl status pm2-USERNAME
See pm2
Leave a Reply