Many admins run extra pieces of software that DA does not check for, to make sure it's running. This is a simple script that enables an admin to keep an eye on any extra software he's running. In this example, we'll be checking on the spamd program. Replace the bold items with your own info where applicable.

#!/bin/sh
COUNT=`ps -ax | grep -v grep | grep -c spamd`
if [ $COUNT -eq 0 ]; then
#the command used to start spamd
/usr/bin/spamd -d -c -m 5

sleep 3

COUNT=`ps -ax | grep -v grep | grep -c spamd`
if [ $COUNT -eq 0 ]; then echo -e "Subject: spamd is downnnspamd is downn.\n\n" | /usr/sbin/exim your@email.com
fi
fi
exit 0;

Throw that code into your own script file, chmod it to 755, then add a root cronjob to check on it as often as you like. DA checks for services once per minute. However, this script doesn't know if it just sent an email the previous minute, so if the service is still down, you'll get one email every minute. So maybe every 5 or 10 minutes is sufficient.

Răspunsul a fost util? 0 utilizatori au considerat informația utilă (0 Voturi)