diff --git a/sa-update.cronscript b/sa-update.cronscript index 6d645bb..cab2411 100644 --- a/sa-update.cronscript +++ b/sa-update.cronscript @@ -1,11 +1,23 @@ #!/bin/bash # *** DO NOT MODIFY THIS FILE *** -# Edit /etc/cron.d/sa-update to enable nightly automatic updates +# # /etc/mail/spamassassin/sa-update-channels.txt # Specify custom channels here +# # /etc/mail/spamassassin/sa-update-keys.txt # Specify trusted GPG keys for custom channels here +# 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 + # Sleep random amount of time before proceeding to avoid overwhelming the servers sleep $(expr $RANDOM % 7200) diff --git a/sa-update.crontab b/sa-update.crontab index 371481f..ca08444 100644 --- a/sa-update.crontab +++ b/sa-update.crontab @@ -1,9 +1,12 @@ -### OPTIONAL: Spamassassin Rules Updates ### +# *** DO NOT MODIFY THIS FILE *** +### Spamassassin Rules Updates ### # # http://wiki.apache.org/spamassassin/RuleUpdates -# Highly recommended that you read the documentation before using this. -# ENABLE UPDATES AT YOUR OWN RISK. +# +# sa-update automatically updates your rules once per day if a spam daemon like +# spamd or amavisd are running. You can force sa-update to run in +# /etc/sysconfig/sa-update # # /var/log/sa-update.log contains a history log of sa-update runs -#10 4 * * * root /usr/share/spamassassin/sa-update.cron 2>&1 | tee -a /var/log/sa-update.log +10 4 * * * root /usr/share/spamassassin/sa-update.cron 2>&1 | tee -a /var/log/sa-update.log diff --git a/sa-update.force-sysconfig b/sa-update.force-sysconfig new file mode 100644 index 0000000..e9de72c --- /dev/null +++ b/sa-update.force-sysconfig @@ -0,0 +1,4 @@ +# Uncomment below to force nightly sa-update +# (you don't need to do this if you use spamd or amavisd) + +#SAUPDATE=yes diff --git a/spamassassin.spec b/spamassassin.spec index 259fcc3..dbe966d 100644 --- a/spamassassin.spec +++ b/spamassassin.spec @@ -1,7 +1,7 @@ # OVERRIDE RHEL VERSION HERE, RHEL BUILDSYSTEM DOESN'T HAVE DIST TAG #%%define rhel 4 -#%define _source_filedigest_algorithm md5 +%define _source_filedigest_algorithm md5 # Define Variables that must exist %{?!rhel:%define rhel 0} @@ -55,7 +55,7 @@ Name: spamassassin Version: 3.3.0 %define prename rc1 %define proposed .proposed2 -Release: 0.26.%{prename}%{?dist} +Release: 0.27.%{prename}%{?dist} License: ASL 2.0 Group: Applications/Internet URL: http://spamassassin.apache.org/ @@ -68,6 +68,7 @@ Source5: spamassassin.sysconfig Source6: sa-update.logrotate Source7: sa-update.crontab Source8: sa-update.cronscript +Source9: sa-update.force-sysconfig Source10: spamassassin-helper.sh Source11: sa-update-channels.txt Source12: sa-update-keys.txt @@ -174,6 +175,7 @@ install -m 0644 %{SOURCE4} %buildroot/etc/mail/spamassassin install -m 0755 %{SOURCE10} %buildroot/etc/mail/spamassassin install -m 0644 %{SOURCE6} %buildroot/etc/logrotate.d/sa-update install -m 0644 %{SOURCE7} %buildroot/etc/cron.d/sa-update +install -m 0644 %{SOURCE9} %buildroot%{_sysconfdir}/sysconfig/sa-update # installed mode 744 as non root users can't run it, but can read it. install -m 0744 %{SOURCE8} %buildroot%{_datadir}/spamassassin/sa-update.cron install -m 0644 %{SOURCE13} %buildroot%{_datadir}/spamassassin/ @@ -217,7 +219,8 @@ echo 783 > $RPM_BUILD_ROOT%{_sysconfdir}/portreserve/spamd %{_initrddir}/spamassassin %config(noreplace) %{_sysconfdir}/mail/spamassassin %config(noreplace) %{_sysconfdir}/sysconfig/spamassassin -%config(noreplace) %{_sysconfdir}/cron.d/sa-update +%config(noreplace) %{_sysconfdir}/sysconfig/sa-update +%{_sysconfdir}/cron.d/sa-update %dir %{_datadir}/spamassassin %dir %{_localstatedir}/run/spamassassin %dir %{_localstatedir}/lib/spamassassin @@ -261,6 +264,10 @@ fi exit 0 %changelog +* Mon Dec 28 2009 Warren Togami - 3.3.0-0.27.rc1 +- sa-update runs in cron automatically if spamd or amavisd is running + If you use neither, you may force sa-update by editing /etc/sysconfig/sa-update. + * Mon Dec 21 2009 Warren Togami - 3.3.0-0.26.rc1 - 3.3.0-rc1.proposed2 with fixed spamc