繁体   English   中英

延迟监视进程的重新启动

[英]Delay restart of processes in monit

我可以修改montrc,以便它不会立即重新启动过程。 在重启之前,该过程必须停机一个完整的周期。 这样我就可以保留现有的capistrano部署。

您可以使用类似:

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

要么

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

如果您仅监视PID文件,我认为当前不可能做到这一点。 但是,如果您还通过侦听端口来监视服务,则可以if failed port 8080 X times within Y cycles then restart添加if failed port 8080 X times within Y cycles then restart子句。 然后,Monit将在每个周期卷曲该端口,并且当故障计数在Y个周期内达到X时,它将尝试重新启动服务。

请记住,这只会影响端口监视器。 如果monit注意到PID文件不存在,它将立即尝试重新启动它。

尝试

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

在重新启动死进程之前,这将至少等待1个完整周期。

暂无
暂无

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

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