mirror of
https://github.com/MailScanner/v5.git
synced 2024-11-15 13:14:33 +08:00
7745377b3d
this is not ready yet so don’t use it
38 lines
937 B
Bash
38 lines
937 B
Bash
#!/bin/bash
|
|
|
|
SAUPDATE=/usr/bin/sa-update
|
|
SACOMPILE=/usr/bin/sa-compile
|
|
SAUPDATEARGS=""
|
|
|
|
export SAUPDATE
|
|
export SACOMPILE
|
|
export SAUPDATEARGS
|
|
UPDATESUCCESS=0
|
|
COMPILESUCCESS=0
|
|
LOGFILE=/tmp/ms-update-sa.$(date +%m%d)
|
|
|
|
# Update SpamAssassin rules
|
|
[ -x $SAUPDATE ] || exit 0
|
|
rm -f $LOGFILE
|
|
$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 && grep -q '^loadplugin.*Rule2XSBody' /etc/mail/spamassassin/*pre 2>/dev/null ; then
|
|
$SACOMPILE >>$LOGFILE 2>&1
|
|
COMPILESUCCESS=$?
|
|
else
|
|
echo $SACOMPILE does not exist or Rule2XSBody plugin not enabled >>$LOGFILE
|
|
COMPILESUCCESS=1
|
|
fi
|
|
fi
|
|
|
|
/etc/init.d/mailscanner reload >>$LOGFILE 2>&1
|
|
|
|
# Only delete the logfile if the update succeeded
|
|
if [ $UPDATESUCCESS = 0 -a $COMPILESUCCESS = 0 -o $UPDATESUCCESS = 1 ]; then
|
|
rm -f $LOGFILE
|
|
fi
|
|
|
|
exit 0
|