[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Processes starting twice when using "check program"
From: |
Callum Macdonald |
Subject: |
Re: Processes starting twice when using "check program" |
Date: |
Thu, 06 Sep 2012 11:26:11 +0100 |
You could call worker_status.sh as part of start_worker.sh to make sure
that the worker is not already running. That's probably a good idea
anyway, so that your process can't be started twice. Not sure about the
monit angle, maybe there's something that can be changed there. - C
On Wed, 2012-09-05 at 22:22 -0700, Jonathan Apostoles wrote:
> 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