简体   繁体   English

延迟监视进程的重新启动

[英]Delay restart of processes in monit

Can I modify montrc so that it will not restart process immediately. 我可以修改montrc,以便它不会立即重新启动过程。 The process has to be down for a full cycle before a restart is triggered. 在重启之前,该过程必须停机一个完整的周期。 This is so I can keep my existing capistrano deploys. 这样我就可以保留现有的capistrano部署。

you can use something like : 您可以使用类似:

check process x with pidfile /var/run/x.pid
   every y cycles

or 要么

start program = "/etc/init.d/x start" with timeout 90 seconds

I do not think it is currently possible to do that if you're monitoring only the PID file. 如果您仅监视PID文件,我认为当前不可能做到这一点。 If however, you are also monitoring the service by listening in on a port, you can add a if failed port 8080 X times within Y cycles then restart clause. 但是,如果您还通过侦听端口来监视服务,则可以if failed port 8080 X times within Y cycles then restart添加if failed port 8080 X times within Y cycles then restart子句。 Monit will then curl that port every cycle, and when the count of failures reaches X across Y cycles, it will attempt to restart the service. 然后,Monit将在每个周期卷曲该端口,并且当故障计数在Y个周期内达到X时,它将尝试重新启动服务。

Keep in mind that this only affects the port monitor. 请记住,这只会影响端口监视器。 If monit notices the PID file is gone, it will immediately try to restart it. 如果monit注意到PID文件不存在,它将立即尝试重新启动它。

Try 尝试

check process x with pidfile /var/run/x.pid
  if does not exist for 2 cycles then start

This will wait a minimum of 1 full cycle before restarting the dead process. 在重新启动死进程之前,这将至少等待1个完整周期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM