Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 19th February 2007, 20:05
bluethunder82 bluethunder82 is offline
Member
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 9 Times in 5 Posts
Cool Getting sa-update running automatically

In order to get your spam under control (well in the right direction) you can run the sa-update command and keep your 'rules' up-to-date. I'll outline what I have been using and am happy with. This may be obvious for some but hopefully helpful for others.

First, sa-update needs to have two additional perl modules installed that are not needed required for spamassassin to function. These are LWP, Archive::Tar (Nov 2006 bug report). It was also mentioned that UserAgent.pm was not installed by default elsewhere in this forum. In order get all the required perl modules installed use the following command:

Code:
apt-get install libwww-perl libarchive-tar-perl
This will allow the script sa-update to run and update your rules. However who wants to do this manually? I have created by own script that emails me the results of the updates each morning. For me this is preferred as I get many other daily emails from the servers so I can keep an eye on my background tasks.

(I'll assume you know how to create and make executable the sh script)

Code:
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/admispconfig/ispconfig/tools/spamassassin/usr/bin

#########################################################################################################################
#Written by Jason Shewchuk                                                                                              #
#E-Mail: jason <> shewchuk.ca                                                                                           #
#Version: 0                                                                                                             #
#Date Created: Sept. 20, 2006                                                                                           #
#Date Modified: Sept. 20, 2006                                                                                          #
#Feel free to use and modify this script.  Let me know of changes you have made so I can learn and improve this script  #
#########################################################################################################################

#Today's date
today=$(date +%Y_%m_%d)

#Run sa-update
/home/admispconfig/ispconfig/tools/spamassassin/usr/bin/sa-update

exitcode=$?     #Exit code from sa-update

#Find version of sa-update
version=$(/home/admispconfig/ispconfig/tools/spamassassin/usr/bin/sa-update -V | grep "sa-update")

if [ $exitcode = 0 ]; then
        echo "An update was available, and was downloaded and installed successfully.  You are now running $version."  | formail -c -I"Subject: sa-update Updated for $today - Updated" -I"From: sa-update@localhost" -I"To: postmaster@{YOURDOMAIN.TLD}" -I"Received: from {YOURDOMAIN.TLD} ([{IP Address If You Wish}])" | sendmail postmaster@{YOURDOMAIN.TLD}

elif [ $exitcode = 1 ]; then
        echo "No update was available.  You are still running $version." | formail -c -I"Subject: sa-update Update Status for $today - No Update" -I"From: sa-update@localhost" -I"To: postmaster@{YOURDOMAIN.TLD}" -I"Received: from {YOURDOMAIN.TLD} ([{IP Address If You Wish}])" | sendmail postmaster@{YOURDOMAIN.TLD}

else
        echo "An error occured while attempting to download and extract updates.  You are still running $version." | formail -c -I"Subject: sa-update Update Status for $today - Error" -I"From: sa-update@localhost" -I"To: postmaster@{YOURDOMAIN.TLD}" -I"Received: from {YOURDOMAIN.TLD} ([{IP Address If You Wish}])" | sendmail postmaster@{YOURDOMAIN.TLD}
fi

exit 0
You will need to update anything located in the {} brackets.

Once this is done jump into your crontab.
Code:
crontab -e
Then make your entry. My script in this example is located in the root of 'root's' directory. I've also got the script running at 03:00.

Code:
0 3 * * * /root/sa-updater &> /dev/null
If you don't want the emails sent to you daily then just use the following crontab statement.

Code:
0 3 * * * /home/admispconfig/ispconfig/tools/spamassassin/usr/bin/sa-update &> /dev/null
That should be about it.

Hope this is helpful. I'm running this with Ubuntu 6.06 (PPC and x86) I'd like feedback on how this performs in other environments.
Reply With Quote
The Following 5 Users Say Thank You to bluethunder82 For This Useful Post:
commentator (27th May 2009), madmucho (16th April 2009), nfomaniak (13th March 2011), sm0rgm (4th January 2010), zetnsh (26th May 2009)
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 4 TPS mail problem Hagforce HOWTO-Related Questions 13 10th February 2010 19:23
php 5.2.0 update! cybereatl Installation/Configuration 1 15th November 2006 10:22
HotSaNIC domino Tips/Tricks/Mods 23 6th November 2006 06:19
install Net::DNS chrno Installation/Configuration 4 5th September 2006 18:01
WARNING: services not running MicCo Installation/Configuration 31 4th September 2006 13:16


All times are GMT +2. The time now is 06:57.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.