I used a cronjob to check it.
Although I'm sure there must be something out there to do this for you
------------------8<-----------------------
#!/bin/bash
#
# Monitor service, try to restart, mail if can't and then mail again every
10 runs.
#
. $HOME/conf/config.txt
# Daemon you want to monitor exactly how it appears in /etc/init.d/
SERVICE='clamd'
# Daemon you want to monitor exactly how it appears in netstat -na
preceeded by a space
SLISTEN=' /var/run/clamav/clamd.sock'
NETSTAT=`netstat -na | grep -c $SLISTEN`
COUNTER=`cat $DATADIR/procs.$SERVICE.status`
PSCOUNT=`ps aux | grep -c $SERVICE`
if [ "$NETSTAT" -lt '1' ]; then
if [ "$COUNTER" -eq '0' ]; then
echo '1' > "$DATADIR/procs.$SERVICE.status" ;
`/etc/init.d/$SERVICE restart`
fi
if [ "$COUNTER" -eq '1' ]; then
echo '2' > "$DATADIR/procs.$SERVICE.status" ;
ps aux | grep $SERVICE | mail -s "`hostname`: $SERVICE not running"
$EMAIL ;
fi
if [ "$COUNTER" -eq '2' ]; then
echo '3' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '3' ]; then
echo '4' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '4' ]; then
echo '5' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '5' ]; then
echo '6' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '6' ]; then
echo '7' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '7' ]; then
echo '8' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '8' ]; then
echo '9' > "$DATADIR/procs.$SERVICE.status" ;
fi
if [ "$COUNTER" -eq '9' ]; then
echo '1' > "$DATADIR/procs.$SERVICE.status" ;
fi
fi
if [ "$NETSTAT" -gt '0' ]; then
echo '0' > "$DATADIR/procs.$SERVICE.status" ;
fi
echo $PSCOUNT > $DATADIR/procs.$SERVICE.txt
SQLquery1="INSERT INTO $PROCHISTTBL ( id , date , host , proc , value )
VALUES ( NULL , NULL , '`hostname`', '$SERVICE', '$PSCOUNT' )";
mysql --user="${MySQLuser}" --password="${MySQLpassword}" -D $MONDB -e
"${SQLquery1}"
------------------8<-----------------------
On Thu, 8 Nov 2007 22:30:28 +1100 (EST), "Voytek Eymont" <[EMAIL PROTECTED]>
wrote:
> whilst in the past clamd has proven extremely reliable, in the last few
> weeks I had clamd die maube on 3 ocassions for some reason (perhaps
> related to the additional third party signature downloads getting
> corrupted?);
>
> so I was thinking of some sort of deamon monitor, if it dies to restart
> it, any suggestions ?
>
>
> --
> Voytek
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> AMaViS-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amavis-user
> AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
> AMaViS-HowTos:http://www.amavis.org/howto/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/