monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q about running external scripts


From: Jan-Henrik Haukeland
Subject: Re: Q about running external scripts
Date: Wed, 28 Jan 2004 20:21:29 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux)

Whit Blauvelt <address@hidden> writes:

> Okay, the main problem I was having with the kill script was that the perms
> weren't letting monit run it, and then monit was taking a long time to time
> out on that - and asking monit to do other things from the command line
> while it's timing out apparently just isn't safe and can get monit into
> quite a confused state. 
>
> So it was a silly mistake on my part (although I had had the perms right on
> the version of the kill script I was testing yesterday - so that was some
> other problem yet to be diagnosed). But it was a silly mistake that seems to
> run up against a part of monit's code that's not robust yet, maybe. I was
> able to duplicate monit's confused state there in a few more runs, too.
>

Well, here's the twist, monit may appear unrobust in the case when
"monit quit" is called but it isn't really that bad.

This is what happens when you do a 'monit quit', a SIGTERM signal is
sent to the monit daemon and "monit daemon with pid [xxx] killed" is
written to the console. Normally the SIGTERM signal is catched right
away by monit and the monit daemon is stopped. *But* if monit is in
the middle of checking a service the quit signal is deferred until the
check is done, *then* monit quits.

The code in monit looks something like this

for all services do
    begin
        block signal
            check service
        unblock signal
    end     

Now, if the check service function take some time, for example testing
a port connection times out after 5 seconds or more, it will take at
least 5 seconds from "monit quit" was called to monit actually
quits. This is probably what you saw when you did a ps. I.e. that
monit was running even if you called "monit quit".

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]