Delay process start after it died

Issue #121 resolved
Former user created an issue

It seems it's not currently possible to delay process start if it has stopped, something like:

check process ... with pidfile ... start = "/etc/init.d/..." delay start 2 cycle

Which would mean then if process died, Monit should wait for 2 cycles (and recheck at that time if process still does not exist) before trying to start it.

This is useful for example if a process was manually restarted. Currently if you restart a process manually, there is a slight chance the process will be started two times - one time manually, and one time by monit (which noticed it was dead between start and stop).

For some software, like Resque this leads to problems (second instance for example could have no pidfile and will hang unnoticed until killed manually, in case of Resque)

Comments (2)

  1. Tildeslash repo owner

    You can just override implicit process existence test like this:

    check process foobar with pidfile ...
        start program = ...
        stop program = ...
        if does not exist for 2 cycles then restart
    
  2. Log in to comment