https://pm2.keymetrics.io/docs/usage/startup/
npm install -g pm2@latest
pm2 startup
Saving current process list
Once you started all the applications you want to manage, you have to save the list you wanna respawn at machine reboot with:
pm2 save
It will save the process list with the corresponding environments into the dump file $PM2_HOME/.pm2/dump.pm2
Stop PM2 deamon
pm2 kill
Startup PM2 with specific user
pm2 startup -u superuser --hp /home/superuser
Demonize PM2 with specific user
sudo -Hu superuser pm2 ls
pm2 deploy production setup
pm2 deploy ecosystem.config.js production