#!/bin/bash ############################################################################### # # This script runs sa-update and restarts spamd if neccessary # # Last update : 31.03.2007 # # Inspired by a script by Jason Shewchuk # # This script is public domain. You are free to use, modify or redistribute it. # Please report modifications to elektronaut@virtuatron.de # ############################################################################### # Set some variables sendto="root@localhost" # adjust to your needs # Run sa-update. See man sa-update on how to add channels sa-update # Get exit status exitstatus=$? if [ $exitstatus = 0 ]; then echo "New rules for spamassassin were installed successfully. Restarting spamd." | mail -s"sa-update" $sendto rcspamd restart; exit 0 elif [ $exitstatus = 1 ]; then echo "No updates available. Your Spamassassin rules are up-to-date." | mail -s"sa-update" $sendto exit 0 else echo "sa-update reported an error. Please run manually in debug mode" | mail -s"sa-update" $sendto exit 1 fi