简体   繁体   中英

Delay restart of processes in monit

Can I modify montrc so that it will not restart process immediately. 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.

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. 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. 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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