Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit existing PM2 process

I have an existing PM2 process that I would like to add the "--max-memory-restart" setting to. How can I do that? The process was created from the command line without a JSON file.

If I were creating a new process I would just run:

PM2 start [process name] --max-memory-restart 700M or whatever

How can I do the same for an existing process? How can I confirm that it works?

Thanks!

like image 489
Alex Avatar asked Sep 09 '16 22:09

Alex


People also ask

How do I update pm2 NPM?

In console : pm2 save --First make sure that you saved correctly all your processes. npm install pm2 -g --Then install the latest PM2 version from NPM. pm2 update --And finally update the in-memory PM2 process.

How do I restart a pm2 process?

Restart on file change To totally disable the watch feature, do: pm2 stop app --watch or toggle the watch option on application restart via pm2 restart app --watch .

How can I see all the pm2 processes?

pm2 runs the process in background as daemon, You can see the logs for individual process using pm2 logs < process_id >. You can not make changes to running process. You can instead allow pm2 to listen to file changes and live-reload the process.


1 Answers

To change your existing PM2 process. you can use this command: pm2 restart [existing name] --max-memory-restart 700M

To check if it affect or not, you can set it with low memory to restart (like 30M). Then check restart time by : pm2 ls command.

Sorry for my bad English. Hope it help.

like image 80
Jem Ha Avatar answered Sep 21 '22 07:09

Jem Ha