最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Edit existing PM2 process - Stack Overflow

programmeradmin1浏览0评论

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!

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!

Share Improve this question asked Sep 9, 2016 at 22:02 AlexAlex 7302 gold badges9 silver badges30 bronze badges 2
  • 1 Is there a reason you cant stop it and start it or restart it? – Craicerjack Commented Sep 12, 2016 at 13:27
  • 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. – Ye Lwin Soe Commented Sep 13, 2016 at 4:52
Add a comment  | 

3 Answers 3

Reset to default 10 +25

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.

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

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.

发布评论

评论列表(0)

  1. 暂无评论