5ec40d41df78e34c5e187b9c9374eae598bebb77
[spamassassin-cn.git] / debian / cron.daily
1 #!/bin/sh
2 # Dinko Korunic <kreator@carnet.hr>
3
4 exec 1>> /var/log/sa-update.log
5 exec 2>&1
6
7 # announce
8 echo "$(date +'%d-%m-%Y %T'): Fetching new SA rules..."
9
10 # update SA from normal SA updates + SARE channels
11 if [ -e /etc/spamassassin/sa-update.channels ]; then
12     sa-update \
13         --channelfile /etc/spamassassin/sa-update.channels \
14         --gpgkey 856AA88A \
15         --gpgkey 24F434CE \
16         --gpgkey BDE9DC10 || \
17     ( echo "$(date +'%d-%m-%Y %T'): No new rules. Exiting now."; exit )
18 fi
19
20 # restart of services
21 echo "$(date +'%d-%m-%Y %T'): Will restart services due to updated rules..."
22 if [ -x /usr/sbin/invoke-rc.d ]; then
23     [ -x /etc/init.d/spamassassin ] && \
24         invoke-rc.d --quiet spamassassin restart
25     [ -x /etc/init.d/amavis ] && \
26         invoke-rc.d --quiet amavis restart
27     [ -x /etc/init.d/postfix ] && \
28         invoke-rc.d --quiet postfix restart
29 else
30     [ -x /etc/init.d/spamassassin ] && \
31         /etc/init.d/spamassassin restart
32     [ -x /etc/init.d/amavis ] && \
33         /etc/init.d/amavis restart
34     [ -x /etc/init.d/postfix ] && \
35         /etc/init.d/postfix restart
36 fi