Edit existing PM2 process
Asked Answered
C

3

10

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!

Calathus answered 9/9, 2016 at 22:2 Comment(2)
Is there a reason you cant stop it and start it or restart it?Lyceum
If your server is an http server u can use Apache Benchmarking Tool and make thousand of request and if your server restart u can check in pm2 status.Tita
B
9

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.

Bookbinding answered 13/9, 2016 at 5:11 Comment(0)
D
4

For 0 downtime you can now also use (more preferable in production):

pm2 reload my_current_name --name my_new_name --max-memory-restart 700M

For differences, please see:

What is the difference between pm2 restart and pm2 reload

Dex answered 14/3, 2019 at 11:56 Comment(0)
O
1

If you want to edit this setting 'WITHOUT' restarting the process, there doesn't seem to be a way to do it. PM2's docs don't list any way to do this, such options have to be stated along with starting the process.

Odele answered 22/9, 2016 at 22:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.