#!/bin/sh /usr/bin/sa-update >> /var/log/sa-update.log 2>&1 ERR=$? # Only restart spamd if sa-update returns 0, meaning it updated the rules if [ $ERR -eq 0 ]; then /etc/init.d/psa-spamassassin restart >> /var/log/sa-update.log 2>&1 fi # if sa-update returns 1 when there are no updates if [ $ERR -eq 1 ]; then exit 0; fi exit $ERR