mirror of
https://github.com/MailScanner/v5.git
synced 2025-02-24 15:35:17 +08:00
update
none
This commit is contained in:
parent
504f8bb291
commit
f5dc14f725
2 changed files with 20 additions and 29 deletions
|
@ -34,7 +34,7 @@ fi
|
|||
if [ $q_days -gt 0 ]; then
|
||||
if [ -d $QUARDIR ]; then
|
||||
cd $QUARDIR
|
||||
logger -i -p mail.notice "NOTICE: ms-clean-quarantine cleaning quarantine older than $q_days days"
|
||||
logger -i -p mail.notice "ms-clean-quarantine: cleaning quarantine older than $q_days days"
|
||||
find . -type f -mtime +$q_days -exec rm -f {} \; >/dev/null 2>&1
|
||||
find . -type d -empty -delete >/dev/null 2>&1
|
||||
fi
|
||||
|
|
|
@ -1,52 +1,43 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# created: Jerry Benton <mailscanner@mailborder.com>
|
||||
# 28 APR 2016
|
||||
|
||||
SAUPDATE=/usr/bin/sa-update
|
||||
SACOMPILE=/usr/bin/sa-compile
|
||||
ms_re2c=/usr/bin/re2c
|
||||
SAUPDATE=`which sa-update`
|
||||
SACOMPILE=`which sa-compile`
|
||||
ms_re2c=`which re2c`
|
||||
SAUPDATEARGS="--refreshmirrors"
|
||||
|
||||
# basic config file
|
||||
if [ -f /etc/MailScanner/defaults ] ; then
|
||||
. /etc/MailScanner/defaults
|
||||
else
|
||||
logger -i -p mail.notice "ERROR: ms-update-sa missing configuration file /etc/MailScanner/defaults"
|
||||
echo "Aborted: missing configuration file /etc/MailScanner/defaults"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export SAUPDATE
|
||||
export SACOMPILE
|
||||
export SAUPDATEARGS
|
||||
UPDATESUCCESS=0
|
||||
COMPILESUCCESS=0
|
||||
LOGFILE=/tmp/ms-update-sa.$(date +%m%d%H%M%S)
|
||||
|
||||
# Update SpamAssassin rules
|
||||
[ -x $SAUPDATE ] || exit 0
|
||||
rm -f $LOGFILE
|
||||
$SAUPDATE $SAUPDATEARGS >$LOGFILE 2>&1
|
||||
UPDATESUCCESS=$?
|
||||
$SAUPDATE $SAUPDATEARGS > $LOGFILE 2>&1
|
||||
UPDATESUCCESS="$?"
|
||||
|
||||
if [ $UPDATESUCCESS = 0 ]; then
|
||||
# If we have sa-compile and they are using the Rule2XSBody plugin then compile
|
||||
if test -x $SACOMPILE && -x $ms_re2c && grep -q '^loadplugin.*Rule2XSBody' /etc/mail/spamassassin/*pre 2>/dev/null ; then
|
||||
$SACOMPILE >>$LOGFILE 2>&1
|
||||
COMPILESUCCESS=$?
|
||||
else
|
||||
echo missing $SACOMPILE or $ms_re2c or Rule2XSBody plugin not enabled >>$LOGFILE
|
||||
COMPILESUCCESS=1
|
||||
fi
|
||||
# If we have sa-compile and they are using the Rule2XSBody plugin then compile
|
||||
grep -q '^loadplugin.*Rule2XSBody' /etc/mail/spamassassin/*pre 2>/dev/null
|
||||
RETVAL="$?"
|
||||
|
||||
if [ -x $SACOMPILE -a -x $ms_re2c -a $RETVAL -eq 0 ] ; then
|
||||
$SACOMPILE >>$LOGFILE 2>&1
|
||||
COMPILESUCCESS=$?
|
||||
logger -i -p mail.notice "ms-update-sa: compiled spamassassin rules"
|
||||
else
|
||||
logger -i -p mail.notice "ms-update-sa: skipped spamassassin sa-compile"
|
||||
COMPILESUCCESS=1
|
||||
fi
|
||||
|
||||
/var/lib/MailScanner/init/mailscanner reload >>$LOGFILE 2>&1
|
||||
|
||||
# Only delete the logfile if the update succeeded
|
||||
if [ $UPDATESUCCESS = 0 -a $COMPILESUCCESS = 0 -o $UPDATESUCCESS = 1 ]; then
|
||||
logger -i -p mail.notice "ms-update-sa: spamassassin signatures updated"
|
||||
logger -i -p mail.notice "ms-update-sa: spamassassin signatures updated"
|
||||
rm -f $LOGFILE
|
||||
/var/lib/MailScanner/init/mailscanner reload >>$LOGFILE 2>&1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue