Spamandclam.sh
From Kolab wiki
[edit]
spamandclam.sh
This bash script will update your spam dbs from a central shared folder and make sure you have the latest clamav antivirus patterns. It needs amail.pl to send confirmation email.
#!/kolab/lib/openpkg/bash # filename: spamandclam.sh # version: 0.1 # Author: Hamish Gough <lists@subvs.co.uk> # Description: Updates clamav and spamassassin for kolab # Change below to match your setup: # MAILFROM: Who the mail result will be from # MAILTO: Who to send the result to # MAILBODY: Optional text file to put in the mail body - default is blank (/dev/null) # AMAILLOC: Full path to amail.pl # SALEARNCMD1: Command to run sa-learn (the default checks a shared folder called "spam" # you can make this shared folder in the kolab2 web admin, or with cyradm) # FRESHCLAMCMD: Command to update clamav # LOGFILE: Full path to temp log file for confirmation email MAILFROM="it@mydomain.com" MAILTO="it@mydomain.com" MAILBODY="/dev/null" AMAILLOC="/data2/amail.pl" SALEARNCMD1="/kolab/bin/sa-learn --spam /kolab/var/imapd/spool/domain/*/shared^spam/[1-9]* --dbpath /kolab/var/amavisd/.spamassassin" FRESHCLAMCMD="/kolab/bin/freshclam" LOGFILE="/data2/spamlog.txt" echo "## SPAMASSASSIN ##" > $LOGFILE echo "" >> $LOGFILE echo "I ran the following command:" >> $LOGFILE echo $SALEARNCMD1 >> $LOGFILE echo "And it told me this:" >> $LOGFILE $SALEARNCMD1 >> $LOGFILE echo "" >> $LOGFILE echo "## CLAMAV ##" >> $LOGFILE echo "" >> $LOGFILE echo "I ran the following command:" >> $LOGFILE echo $FRESHCLAMCMD >> $LOGFILE echo "And it told me this:" >> $LOGFILE $FRESHCLAMCMD >> $LOGFILE echo $AMAILLOC -s "Spamassassin training and antivirus updates" -r $MAILFROM -a $LOGFILE $MAILTO < $MAILBODY
