Vaibhav
Vaibhav

Reputation: 9

pm2 restart all keeps restarting again and again when run from script

I have a script(bash) which monitors pm2 memory usage and restarts the process if pm2 process takes memory more than 2 GB. But when i run the command (pm2 restart all) from the script, all processes in pm2 keep restarting again and again.

I am running this script via a crontab.

I want to be able to successfully restart all apps without continous restart.

Upvotes: 0

Views: 1337

Answers (1)

Tuan Anh Tran
Tuan Anh Tran

Reputation: 7267

pm2 already has an option for max memory which is max_memory_restart: "3G" which will restart the process if it's taking more than 3G for example.

Source: http://pm2.keymetrics.io/docs/usage/process-management/#max-memory-restart

Upvotes: 1

Related Questions