MajorSophos.sh

is a shell script that simplifies the download and installation of the monthly Sophos program updates for users of the MailScanner e-mail virus scanning program. Note that this is only necessary for Sophos version 4. Version 5 (now retired) and version 6 are self-updating.

MajorSophos downloads the file from the Sophos website using your sophos username and password and installs it using the script provided with MailScanner. It works either interactively or from cron. It has an option to download the file but not install it. If run from cron, it can report its results by e-mail and/or write to a log.

Even if you don't set it up to run from cron, it is a timesaver to use it interactively. It does a fair amount of error checking, so it is unlikely it could ever mess up a working installation. It reports the version of installed sophos before and after running. It does this by running sweep (via sophos-wrapper) with the "-v" switch, so if it successfully reports the version you can be pretty confident that the install was a success.

If you want to give it a try, the following procedure will help you build up some confidence in it:

  1. Edit the variables at the top of the script to suit your configuration.
  2. Run with no arguments to see a usage statement.
  3. Run with "-download" argument to see if it can download the file.
  4. rm the temp directory created in 3. (/tmp/MajorSophos.sh.xxxxxx)
  5. Run with "-install" argument to see if it can download and install.
  6. Repeat 2,3,4,5 from cron, if you like.

MajorSophos was originally written and tested on RedHat 7.3 and Fedora Core 1 systems. I noticed that Fedora Core 3 by default does not install the rpm for which. You should be sure to install it manually, as MajorSophos uses it (and surely you will too).

View MajorSophos.sh

Download MajorSophos.sh

If you run MajorSophos monthly from cron, you should be aware of the
Sophos Release Dates. It is probably safe to schedule your download on the first of the month, or thereabouts. I do it on the 7th, because I assume that if there is some problem with the latest release I will read about it on the MailScanner list in time to delay the installation. Here is the command I use in root's crontab:

# run MajorSophos at 3 am on the 7th each month
0 3 7 * * /root/MajorSophos.sh -install

You can see that I keep the program in root's home directory. If you keep it some other place, adjust the path above.

Changelog:

  • 2-02-2006: Now uses the glibc2.2 version of Sophos by default, but still has the older one in a comment line. Better Sophos version information. Now unpacks the downloaded file before calling the MailScanner script.
  • 9-09-2004: Now falls back to simple temp directory naming if "mktemp" program is unavailable. Also cleans up after itself better if download fails. Added default values (commented out) for non-rpm installations of MailScanner.
  • 10-15-2003: Improved configuration comments. Improved Sophos version reporting so it works transparently with MailScanner versions before or after 4.23-11.
  • 10-14-2003: Clarified MailScanner version information in comments.
  • 10-03-2003: Fixed the SOPHOSDIR variable name.
  • 9-25-2003: Added a crude mechanism to work with sophos-wrapper in MailScanner v4.23-11, which requires an extra command line argument defining the sophos installation directory.
  • 4-18-2003: Running with no parameters now prints version of Sophos currently installed, in addition to printing a usage statement.
  • 4-12-2003(approx): Updated default paths for standard MailScanner v4.x installations.
  • 2-27-2003(approx): First public release.