Skip to content

Instantly share code, notes, and snippets.

Avatar

1016 JP1016

View GitHub Profile
View Hello
██╗██████╗ ██╗ ██████╗ ██╗ ██████╗
██║██╔══██╗███║██╔═████╗███║██╔════╝
██║██████╔╝╚██║██║██╔██║╚██║███████╗
██ ██║██╔═══╝ ██║████╔╝██║ ██║██╔═══██╗
╚█████╔╝██║ ██║╚██████╔╝ ██║╚██████╔╝
╚════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝
View PM2 Restart with Server
I ran into this issue, and found a solution that works for me. Let's assume I've created a user named 'node' to run pm2. All of the commands below should be run by the node user, in the node user's home directory (/home/node)
Clear any pm2 dump files, and then start the appropriate services
% pm2 delete all
% pm2 dump
% pm2 start app.js --watch
Save the current config to start on reboot
% pm2 save
% sudo pm2 startup centos -u node
Edit the PM2_HOME path in the pm2-init script to match the home directory of the user:
You can’t perform that action at this time.