You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Cecil Westerhof <Ce...@decebal.nl> on 2010/04/04 18:40:54 UTC
script to run sa-update in cron
I wrote the following script to let sa-update be run in cron. I hope it
is useful for others. When things could be done better: let me know.
#!/usr/bin/env bash
declare -r GREP_REGEX='not installed\|warning'
declare -r LOG_FILE='sa-update.log'
declare PID
declare retVal
cd
sa-update -D 2>${LOG_FILE}
retVal=${?}
case ${retVal} in
0)
echo "Updated SpamAssassin rules"
PID=$(ps aux | grep [/]spamd | awk '{ print $2 }')
if [[ ${PID} = '' ]] ; then
echo 'spamd is not running'
else
kill ${PID}
fi
;;
1)
echo "There where no updates for SpamAssassin rules"
;;
2)
echo "There are updates, but lint check failed"
;;
3)
echo "Unknown error"
;;
*)
echo "Error while trying to download SpamAssasin rules"
;;
esac
echo
grep "${GREP_REGEX}" ${LOG_FILE}
Off course I have in my inittab:
spam:2345:respawn:/usr/bin/spamd --allow-tell
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof