monit-general
[Top][All Lists]
Advanced

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

Q about running external scripts


From: Whit Blauvelt
Subject: Q about running external scripts
Date: Wed, 21 Jan 2004 00:52:20 -0500
User-agent: Mutt/1.5.4i

Hi,

Monit's great stuff. But I'm stuck on how to run an external "stop" script
successfully. I'm running pure-ftpd in a complex setup with multiple
instances and pure-authd in conjunction with it, and there are cases where
the standard monit ftp test succeeds, and pure-authd is still running too,
but logging in has become foobared. I've been able to script with monit's
expect feature to actually test a login. But when that fails I want to stop
pure-ftpd - which I start with a bunch of command line switches (the more
normal way to run that daemon) - so I want to stop it with something along
the lines of:

[kill.sh]=====

#! /bin/sh

kill `cat /var/run/$1.pid`
==============

called through monitrc with

stop program = "/bin/kill.sh pure-ftpd" 

[or pure-ftpd2 - there are multiple instances and this gives it the correct
PID to kill for the instance being tested]

Now, the FAQ mentions path restrictions, but also says /bin is in the monit
path - plus 

/bin/kill `/bin/cat /var/run/$1.pid`

doesn't work from monitrc either - even though either version of this works
from the command line to stop the pure-ftpd instance. 

Actually, I want to do more than the simple kill command in the script - I
think I do need an external script to handle it - but I need to learn why
even that's not working at present.

So ... what obvious thing am I missing. "stop program" statements using
/etc/init.d scripts do work as advertised, and the difference isn't obvious
to me.

Thanks,
Whit




reply via email to

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