Due to the way monit checks statuses it's starting my process twice on
recovery.

Example:
check program locker_worker_status with path "/home/monit/worker_status.sh"
    start program = "/home/monit/start_worker.sh"
    if status != 0 then start

Imagine the worker is down and monit is set to check every minute:

0m- run check program (it's down, but wont read the status code until the
next cycle)

1m- read status, it's DOWN
1m- run check program (it's still down at this point) -- will read next
cycle
1m- since status was down, run start_worker.sh

2m- read status, it's DOWN (since it's from the run @1m)
2m- run check program (it's up at this point) -- will read next cycle
2m- since status was down, run start_worker.sh

3m- read status, it's UP

Is there a way to have it read the status BEFORE responding to it?  The way
it works now it seems to be always a minute behind and suffer from
recovering from a process that has already been recovered.  Is there any
workaround so that my process only starts once?
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to