0dd949e
#!/bin/bash
c40bdd3
# *** DO NOT MODIFY THIS FILE ***
c40bdd3
# Edit /etc/cron.d/sa-update to enable nightly automatic updates
c40bdd3
# /etc/mail/spamassassin/sa-update-channels.txt 
c40bdd3
#     Specify custom channels here
c40bdd3
# /etc/mail/spamassassin/sa-update-keys.txt
c40bdd3
#     Specify trusted GPG keys for custom channels here
0dd949e
c40bdd3
# Sleep random amount of time before proceeding to avoid overwhelming the servers
0dd949e
sleep $(expr $RANDOM % 7200)
c40bdd3
c40bdd3
# sa-update must create keyring
c40bdd3
if [ ! -d /etc/mail/spamassassin/sa-update-keys ]; then
c40bdd3
    sa-update
c40bdd3
fi
c40bdd3
# Import SOUGHT key
c40bdd3
sa-update --import /usr/share/spamassassin/sought-pubkey.txt
c40bdd3
c40bdd3
# Update rules with sa-update, restart spamd if rules were updated
c40bdd3
/usr/bin/sa-update --channelfile /etc/mail/spamassassin/sa-update-channels.txt \
c40bdd3
                   --gpgkeyfile  /etc/mail/spamassassin/sa-update-keys.txt     && \
c40bdd3
                   /etc/init.d/spamassassin condrestart > /dev/null