Skip to content

Instantly share code, notes, and snippets.

@zmts
Last active July 20, 2020 18:33
Show Gist options
  • Save zmts/445b15238b8e5e415c1bfa9bf1d2c08e to your computer and use it in GitHub Desktop.
Save zmts/445b15238b8e5e415c1bfa9bf1d2c08e to your computer and use it in GitHub Desktop.
pm2

PM2

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment