What is the purpose of "pm2 save"?
Solution 1:
pm2 save
takes a snapshot of your currently running Node applications. You can then restore these applications using pm2 resurrect
.
This is useful because it means you don't have to manually restart each application when you restart pm2 (such as a machine reboot). Instead, you can just have a script that calls pm2 resurrect
and it'll start up all the Node apps.
pm2 resurrect
is useful to be called manually. If you want your processes to automatically start on boot, you should create a startup script with pm2 startup
.
Solution 2:
$ pm2 save
is used to save the pm2 process list to relaunch them after a server reboot. It comes generaly with :
pm2 startup
which generates Startup Script