Skip to content

monit pm2 process by 'pgrep node', if only one node process, run specified restart command/script

License

Notifications You must be signed in to change notification settings

zxdong262/pm2-mon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pm2-mon

monit pm2 process by "pgrep node", if only node process, run specified restart command/script.

(I make this thing only because pm2 sometimes crashes, I do not know why it crash, and I have to restart it anyway)

install

npm install pm2-mon -g

help

pm2-mon --help

  Usage: pm2-mon [options]

  monit pm2 process by "pgrep node", if only node process, run specified restart command/script

  Options:

    -h, --help     output usage information
    -V, --version  output the version number
    -t, --timer    check pm2 every {timer} milli second, optional, default is 5000
    -c, --cmd      the restart shell-script path, required, will be runned by sh
    -n, --num      when node process less than {num}, the restart shell-script will run, optional, default is 2

run

pm2-mon -t 5000 -c example/restart.sh -n 3

suggestion

use tj/mon to run this pm2-mon script.

change log

0.0.3 add num param

License

MIT

About

monit pm2 process by 'pgrep node', if only one node process, run specified restart command/script

Resources

License

Stars

Watchers

Forks

Packages

No packages published