> Subject: Re: [Clamav-users] Autochecking script for clamd
> 
> 
> At 08:50 PM 11/27/2003, Brian Bruns wrote:
> >Well, I should have put this in the last message.
> >
> >I guess the one I threw together doesn't require anything special 
> >(doesn't need daemontools), and only needs bash.  I have a habit of 
> >writing things very simply to be as small and lightweight as 
> possible 
> >:)
> 
> daemontools isn't "special", whatever that means, and bash shells are 
> neither small nor lightweight. so, you lose on all counts.
> 

Special is as Special Does!

I use a simple shell script to check for clamd and freshclam since there
have been versions where both/either died.  Plus I timestamp and log.

As far as daemontools, I could never get it to function properly on my
OpenBSD - Postfix - Amavisd system.  This simple script works great.

#!/bin/sh
# redirect output to /var/log/messages file
exec 1>>/var/log/checkclam
exec 2>&1
TIMESTAMP=`date +"%b %e %H:%M:%S"`
# Check for clamd daemon
if ! (ps -aU amavisd | grep clamd | grep -v grep > /dev/null)
then
        echo $TIMESTAMP "restarting clamd"
# Remove Stale Socket
        rm /var/amavisd/clamd.sock
# Start clamd
        /usr/local/sbin/clamd
# Timestamp, log and send me a note
        echo $TIMESTAMP "restarting clamd" > /tmp/clamrestart.txt
        cat /tmp/clamrestart.txt | mail -s "clamd restart report"
[EMAIL PROTECTED] > /dev/null
        rm /tmp/clamrestart.txt > /dev/null
fi
if ! (ps -aU amavisd | grep freshclam | grep -v grep > /dev/null)
then
        echo $TIMESTAMP " restarting freshclam daemon"
/usr/local/bin/freshclam -d -c 4
--datadir=/var/amavisd/usr/local/share/clamav --log-verbose
fi


FYI - Since installing 0.65 this has recorded no restarts


L. A. Duerksen
Technical Manager
Futureware Distributing, Inc
OpenBSD 3.3
amavisd-new-20030616-p2
spamassassin 2.55
postfix-2.0.10
ClamAV version 0.65



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to