Home > Blockchain >  Should "pm2 save" need to be execute again after some script updates?
Should "pm2 save" need to be execute again after some script updates?

Time:08-31

currently i'm using pm2 to manage my process, and i'm still new to this. I've search some docs but still not sure.

About autostartup, what is the propper way to update my nodeJS script? right now, i just execute pm2 restart all after i update some of my script. But since i want to use pm2 startup. Do i need to execute pm2 save also ?

Also on what occasion we need to update PM2 Startup Script? pm2 unstartup then pm2 startup ?

CodePudding user response:

No you don't need to execute pm2 save if your script content change.

pm2 save is only for saving PM2 process configuration. So if the startup script change of location or name, you need to execute pm2 save.

Once executed pm2 save permit you restart all process after a crash or reboot with the command ``pm2 resurrect```

To restart a process use pm2 restart <id> <here id is the id of the process. You should avoid use pm2 restart allfor restarting only one process.

If you use pm2 startup, you need to do a pm2 save each time a process is added or process ecosystem change. pm2 startup just manage for you the automatic starting of PM2 when server reboot.

  • Related