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: Whit Blauvelt
Subject: Re: Q about running external scripts
Date: Wed, 21 Jan 2004 12:34:39 -0500
User-agent: Mutt/1.5.4i

Thanks for all the pointers Jan-Hendrick.

As I'm starting to play with this, I'm getting some really weird stuff. I
was simply trying to test your suggestion to use the environment variable to
identify the process to the external script, so I put your small routine in
/bin/kill2.sh:
 
# more /bin/kill2.sh
#! /bin/sh

if [ "x$MONIT_PROCESS_PID" != "x" ]
then
     kill $MONIT_PROCESS_PID
else
     error
fi

and changed the pure-ftpd section in monitrc to:

check process pure-ftpd with pidfile /var/run/pure-ftpd.pid
    start program = "/usr/sbin/pure-ftpd -S xxx.xxx.xxx.xxx, -F 
/client/ftp/message -A -b -o -B -E -U 113:002 -j --tls=1 
-lextauth:/var/run/ftpd.sock &" 
    stop program = "/bin/kill2.sh"
    if failed host backup.xxxxxxxx.com port 21 protocol ftp then restart
    if 5 restarts within 5 cycles then timeout
    group pure

then:
monit quit
monit
monit stop pure-ftpd

which resulted in a system state where:

# monit quit
monit daemon with pid [31196] killed

# ps x | grep monit
31196 ?        R      3:34 monit
31197 ?        S      0:00 monit
31354 pts/1    S      0:00 grep monit

# monit status
The monit daemon uptime: 10m 
monit: error connecting to the monit daemon
Process 'pure-authd' is running with pid [3804]
        Uptime: 33d 4h 24m 
Process 'pure-ftpd' is running with pid [25153]
        Uptime: 12h 39m ...

And yes pure-ftpd is still running too - it wasn't stopped but trying to
stop it has seriously disoriented monit. I'll try the debugging steps, but
it looks like the bugs will be at a level beyond my depth here. It seems
that monit should not be reporting that it's killed its own process when it
has failed at it, among other things.

Then when I do a kill -9:

# kill -9 31196

# ps x | grep monit
31197 ?        S      0:00 monit
31469 pts/1    S      0:00 grep monit

# monit quit
monit: No daemon process found

# ps x | grep monit
31197 ?        S      0:00 monit
31477 pts/1    S      0:00 grep monit

Okay, monit's running a second process, but it can't see that it is - even
though it has the ability in other circumstances to check the process list
and not just depend on pid files. Is this a place where it needs a more
robust routine?

Back to slogging....

Whit




reply via email to

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