On Sun, Aug 15, 2004 at 05:31:54PM +0200, Micha Silver wrote:
> > 
> > I would love to get emailed a notice when the virus database 
> > has been updated, and when it tried but failed.
> 
> I use the two options in freshclam.conf: OnUpdateExecute and OnErrorExecute
> to call a small script that sends me a success (or failure when that
> happens) message each time. "Quick and dirty". Works fine.
 
I do the same. I leave the retries to my freshclam-failed.sh script.

freshclam-update.sh:

---------------------------------------------
#!/bin/sh
# Mail details of a successful DB update to virusadmin.

# Set notify address as required
VIRUSADM="[EMAIL PROTECTED]"

# Environment and scratch files.
SIGTOOL="/usr/local/bin/sigtool"
VIRUSDBDIR="/var/amavisd/virusdb"
MYHOSTNAME=`/usr/bin/hostname`
VINFO="/tmp/siginfo.`date +%H%M%S`"

# shouldn't be necessary if clam was linked correctly
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

for i in ${VIRUSDBDIR}/*.cvd
do
    echo >> $VINFO
    echo "SIGTOOL INFO FOR ${i}" >> $VINFO
    echo >> $VINFO
    ${SIGTOOL} --stdout --info $i >> $VINFO
    echo >> $VINFO
done

mailx -s "freshclam
update succeeded for ${MYHOSTNAME}" $VIRUSADM <$VINFO

rm $VINFO

---------------------------------------------
freshclam-failed.sh

#!/bin/sh
# Mail to be sent when freshclam fails.

# Set notify address as required
VIRUSADM="[EMAIL PROTECTED]"
MYHOSTNAME=`/usr/bin/hostname`
FCINFO="/tmp/fcinfo.`date +%H%M%S`"

echo "The ClamAV updater freshclam has failed for some reason." >>$FCINFO
echo "Please investigate (/var/log/clamav.log might be useful)." >>$FCINFO
echo >>$FCINFO
echo "Trying again ..." >>$FCINFO
echo >>$FCINFO

# try again and touch the "failed" file if it still fails so we know
# when the last actual failure was.
/usr/local/bin/freshclam --stdout \
  --on-error-execute="touch /var/amavisd/freshclam-failed" >>$FCINFO

mailx -s "Freshclam update FAILED on ${MYHOSTNAME}" $VIRUSADM <$FCINFO

rm $FCINFO




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to