2006-12-14 20:36:20 +00:00
|
|
|
#!/bin/bash
|
2009-09-25 04:15:56 +00:00
|
|
|
# *** DO NOT MODIFY THIS FILE ***
|
2009-12-28 06:42:03 +00:00
|
|
|
#
|
2009-09-25 04:15:56 +00:00
|
|
|
# /etc/mail/spamassassin/sa-update-channels.txt
|
|
|
|
# Specify custom channels here
|
2009-12-28 06:42:03 +00:00
|
|
|
#
|
2009-09-25 04:15:56 +00:00
|
|
|
# /etc/mail/spamassassin/sa-update-keys.txt
|
|
|
|
# Specify trusted GPG keys for custom channels here
|
2006-12-14 20:36:20 +00:00
|
|
|
|
2009-12-28 06:42:03 +00:00
|
|
|
# Proceed with sa-update if spam daemon is running or forced in /etc/sysconfig/sa-update
|
|
|
|
unset SAUPDATE
|
|
|
|
[ -f /etc/sysconfig/sa-update ] && . /etc/sysconfig/sa-update
|
|
|
|
for daemon in spamd amavisd; do
|
|
|
|
/sbin/pidof $daemon >& /dev/null
|
|
|
|
[ $? -eq 0 ] && SAUPDATE=yes
|
|
|
|
done
|
|
|
|
|
|
|
|
# Skip sa-update if daemon not detected
|
|
|
|
[ -z "$SAUPDATE" ] && exit 0
|
|
|
|
|
2009-09-25 04:15:56 +00:00
|
|
|
# Sleep random amount of time before proceeding to avoid overwhelming the servers
|
2006-12-14 20:36:20 +00:00
|
|
|
sleep $(expr $RANDOM % 7200)
|
2009-09-25 04:15:56 +00:00
|
|
|
|
|
|
|
# sa-update must create keyring
|
|
|
|
if [ ! -d /etc/mail/spamassassin/sa-update-keys ]; then
|
|
|
|
sa-update
|
|
|
|
fi
|
|
|
|
# Import SOUGHT key
|
|
|
|
sa-update --import /usr/share/spamassassin/sought-pubkey.txt
|
|
|
|
|
|
|
|
# Update rules with sa-update, restart spamd if rules were updated
|
|
|
|
/usr/bin/sa-update --channelfile /etc/mail/spamassassin/sa-update-channels.txt \
|
|
|
|
--gpgkeyfile /etc/mail/spamassassin/sa-update-keys.txt && \
|
|
|
|
/etc/init.d/spamassassin condrestart > /dev/null
|