keeping RMA running
keeping RMA running
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?
Done. RMA 1.25 available for download at http://www.ks-soft.net/hostmon.eng/downpage.htm#unix
Regards
Alex
Regards
Alex
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.
And this crontab entry tells cron to run rmachk every minute:
![;)](./images/smilies/icon_wink.gif)
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
Code: Select all
* * * * * /rma/rmachk > /dev/null 2>&1