Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of "pm2 save"?

Tags:

node.js

pm2

I am using pm2 to manage my node.js processes. Very happy with it so far.

What is the purpose of $ pm2 save? What is the purpose of saving a process list? I don't quite understand from the documentation. https://github.com/Unitech/pm2

like image 507
guagay_wk Avatar asked Mar 09 '16 05:03

guagay_wk


People also ask

How do you save a PM2 process?

Saving all running PM2 processesMake sure you have all the PM2 processes running you want on startup. This will create a dump. pm2 , which will auto startup our scripts. Now, whenever your server reboots, your processes will automatically restart as well 🤗.

What is PM2 and how do you use it?

PM2 is an advanced process manager for NodeJS applications that allows you quickly start, control, or stop your node processes. It runs as a daemon on the server and will make sure your app is available 24/7/365! Of course, we at HostArmada want to offer our clients the best tools to manage their NodeJS applications.

What is PM2 Linux?

PM2 is an acronym of Process Management Module which is used to run and manage Node. js applications. It's an open-source with an in-built load balancer. When a process goes down, PM2 will automatically restart the service and make it Live. PM2 works on Linux, Windows, and macOS.


2 Answers

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.

like image 83
Rowan Freeman Avatar answered Sep 21 '22 10:09

Rowan Freeman


$ 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

like image 30
Badr Bellaj Avatar answered Sep 18 '22 10:09

Badr Bellaj