8

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!

Alex
  • 690
  • 1
  • 9
  • 29

3 Answers3

8

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.

Jem Ha
  • 106
  • 3
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

Steffan
  • 704
  • 1
  • 11
  • 25
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.

Omar A
  • 435
  • 7
  • 14