Mageia Bugzilla – Attachment 4356 Details for
Bug 11246
amavisd-new should be reloaded after running sa-update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
/etc/cron.daily/spamassassin script from debian
spamassassin (text/plain), 1.93 KB, created by
Luca Olivetti
on 2013-09-17 13:28:06 CEST
(
hide
)
Description:
/etc/cron.daily/spamassassin script from debian
Filename:
MIME Type:
Creator:
Luca Olivetti
Created:
2013-09-17 13:28:06 CEST
Size:
1.93 KB
patch
obsolete
>#!/bin/sh > ># Duncan Findlay ># duncf@debian.org > ># Daily cronjob for SpamAssassin updates. This isn't pretty but it ># should do the job. > >CRON=0 > >test -f /etc/default/spamassassin && . /etc/default/spamassassin > >test -x /usr/bin/sa-update || exit 0 >test -x /etc/init.d/spamassassin || exit 0 > >if [ "$CRON" = "0" ] ; then > exit 0 >fi > ># If there's a problem with the ruleset or configs, print the output ># of spamassassin --lint (which will typically get emailed to root) ># and abort. >die_with_lint() { > su debian-spamd -c "spamassassin --lint -D 2>&1" > exit 1 >} > >do_compile() { ># Compile, if rules have previously been compiled, and it's possible > if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile \ > -a -d /var/lib/spamassassin/compiled ]; then > su debian-spamd -c "sa-compile --quiet" > # Fixup perms -- group and other should be able to > # read and execute, but never write. Works around > # sa-compile's failure to obey umask. > chmod -R go-w,go+rX /var/lib/spamassassin/compiled > fi >} > ># Tell a running spamd to reload its configs and rules. >reload() { > # Reload > if which invoke-rc.d >/dev/null 2>&1; then > invoke-rc.d spamassassin reload > /dev/null > else > /etc/init.d/spamassassin reload > /dev/null > fi > if [ -d /etc/spamassassin/sa-update-hooks.d ]; then > run-parts --lsbsysinit /etc/spamassassin/sa-update-hooks.d > fi >} > ># Sleep for up to 3600 seconds >RANGE=3600 >number=`od -vAn -N2 -tu4 < /dev/urandom` >number=`expr $number "%" $RANGE` >sleep $number > > ># Update >umask 022 >su debian-spamd -c "sa-update --gpghomedir /var/lib/spamassassin/sa-update-keys" > >case $? in > 0) > # got updates! > su debian-spamd -c "spamassassin --lint" || die_with_lint > do_compile > reload > ;; > 1) > # no updates > exit 0 > ;; > 2) > # lint failed! > die_with_lint > ;; > *) > echo "sa-update failed for unknown reasons" 1>&2 > ;; >esac >
#!/bin/sh # Duncan Findlay # duncf@debian.org # Daily cronjob for SpamAssassin updates. This isn't pretty but it # should do the job. CRON=0 test -f /etc/default/spamassassin && . /etc/default/spamassassin test -x /usr/bin/sa-update || exit 0 test -x /etc/init.d/spamassassin || exit 0 if [ "$CRON" = "0" ] ; then exit 0 fi # If there's a problem with the ruleset or configs, print the output # of spamassassin --lint (which will typically get emailed to root) # and abort. die_with_lint() { su debian-spamd -c "spamassassin --lint -D 2>&1" exit 1 } do_compile() { # Compile, if rules have previously been compiled, and it's possible if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile \ -a -d /var/lib/spamassassin/compiled ]; then su debian-spamd -c "sa-compile --quiet" # Fixup perms -- group and other should be able to # read and execute, but never write. Works around # sa-compile's failure to obey umask. chmod -R go-w,go+rX /var/lib/spamassassin/compiled fi } # Tell a running spamd to reload its configs and rules. reload() { # Reload if which invoke-rc.d >/dev/null 2>&1; then invoke-rc.d spamassassin reload > /dev/null else /etc/init.d/spamassassin reload > /dev/null fi if [ -d /etc/spamassassin/sa-update-hooks.d ]; then run-parts --lsbsysinit /etc/spamassassin/sa-update-hooks.d fi } # Sleep for up to 3600 seconds RANGE=3600 number=`od -vAn -N2 -tu4 < /dev/urandom` number=`expr $number "%" $RANGE` sleep $number # Update umask 022 su debian-spamd -c "sa-update --gpghomedir /var/lib/spamassassin/sa-update-keys" case $? in 0) # got updates! su debian-spamd -c "spamassassin --lint" || die_with_lint do_compile reload ;; 1) # no updates exit 0 ;; 2) # lint failed! die_with_lint ;; *) echo "sa-update failed for unknown reasons" 1>&2 ;; esac
View Attachment As Raw
Actions:
View
Attachments on
bug 11246
: 4356