#!/bin/sh # A simple script to update the SA rules. There is very little error # checking here. It is implied your machine has network, dns resolving # and all that. # # Oden Eriksson <oeriksson@mandriva.com> # Source spamd configuration. . /etc/sysconfig/spamd if [ "${USE_SA_UPDATE}" == "1" ]; then LOCKFILE="/tmp/sa-update.lock" if [ -f ${LOCKFILE} ]; then echo "the ${LOCKFILE} file was found indicating an error. Maybe sa-update is still running..." exit 1 fi # make the lockfile touch ${LOCKFILE} /usr/bin/sa-update RETVAL=$? if [ $RETVAL -eq 0 ]; then /etc/rc.d/init.d/spamd condrestart rm -f ${LOCKFILE} exit 0 fi if [ $RETVAL -eq 1 ]; then echo "No new rules was downloaded" rm -f ${LOCKFILE} exit 0 fi if [ $RETVAL -gt 4 ]; then echo "There were problems with the updated rules, spamd was not restarted" rm -f ${LOCKFILE} exit 1 fi fi