Reputation: 9
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
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