Page 1 of 1

keeping RMA running

Posted: Fri Apr 27, 2007 5:16 pm
by voor
I would like to make sure that RMA is always running on my servers and restart it if it died or has been killed for some reason. For other programs that generate a <program>.pid file like syslogd, I can do this in crontab by reading the PID from the file and then checking the process table. Is there any option to make RMA save its PID to a file in a similar manner?

Posted: Fri Apr 27, 2007 5:24 pm
by KS-Soft
Probably we can implement such option in next version

Regards
Alex

Posted: Fri Apr 27, 2007 5:51 pm
by voor
That would be great, looking forward to it! :D

Posted: Tue May 08, 2007 8:26 pm
by KS-Soft
Done. RMA 1.25 available for download at http://www.ks-soft.net/hostmon.eng/downpage.htm#unix

Regards
Alex

Posted: Wed May 16, 2007 8:00 pm
by voor
Works perfectly, thanks!

Posted: Mon May 21, 2007 7:03 pm
by voor
If anyone is interested, this 'rmachk' Bourne shell script is what I use to check whether RMA is running. If it's not running, then the script will start it and redirect the startup output to /dev/null. Much of the code was shamelessly borrowed from psybncchk. ;) The RMA client must be version 1.25 or higher and the PidFile line in rma.ini must be uncommented.

Code: Select all

#!/bin/sh

# assume the 'rma' executable is at /rma/rma and the PID file is at /var/run/rma.pid

RMAPATH=/rma
RMAPIDPATH=/var/run

# if 'kill -CHLD' is not recognized by the OS (like Solaris), try 'kill -CLD' instead

if test -r $RMAPIDPATH/rma.pid; then
    RMAPID=`cat $RMAPIDPATH/rma.pid`
    if `kill -CHLD $RMAPID >/dev/null 2>&1`
    then
        exit 0
    fi
fi
cd $RMAPATH
./rma rma.ini > /dev/null 2>&1
And this crontab entry tells cron to run rmachk every minute:

Code: Select all

* * * * * /rma/rmachk > /dev/null 2>&1

Posted: Tue May 22, 2007 8:45 am
by KS-Soft
Thank you for contribution :)

Regards
Alex