Monit检查多个pidfiles的进程

我有一个多节点进程的Nodejs Web应用程序,我开始多次使用pm2 start app.js

为了监视这些进程,我使用pm2的: pm2 startup ubuntu命令创build了一个init脚本。 然后,在我的App的monitconfiguration文件中,我使用这个init脚本作为启动和停止monit的程序命令。 然后,我使用像check process pm2_1 with pidfile /path/to/node-pidfile这样的check process pm2_1 with pidfile /path/to/node-pidfileconfiguration文件中的两个进程。

我希望monit检查这两个进程的pidfiles,当其中一个进程或两个进程都closures时,重新启动这两个进程。 所以,这是我的webapp.monitrc的样子:

  check process pm2_1 with pidfile /root/.pm2/pids/proc1-0.pid start program = "/etc/init.d/pm2-init.sh start" stop program = "/etc/init.d/pm2-init.sh stop" check process pm2_2 with pidfile /root/.pm2/pids/proc2-1.pid start program = "/etc/init.d/pm2-init.sh start" stop program = "/etc/init.d/pm2-init.sh stop" 

问题是,如果其中任何一个进程停机,它都可以工作。 但是,如果两个进程都closures,monit会执行两次启动命令。

有没有办法让检查进程有一个“OR”条件来监视多个不同的pidfiles并只执行一次相同的启动和停止命令?