LJ Archive

Listing 1. sigupdate Script

#!/bin/sh
mailto="admin@domain.com"
tstamp=`date`
hostname=`hostname`

### Create a temporary dir in /tmp
pushd /tmp
mkdir sigupdate
pushd sigupdate

### Get signature update file via ftp
ftp ftp.nai.com

### Unpack signature file
export filename=`ls dat-*.tar`
tar -xf $filename

### Move signature files to virus-scan directory
mv *.dat /usr/local/uvscan

### Clean up temp directory and leave
rm $filename
rm *
popd
rmdir sigupdate
popd

### Send an e-mail to the administrator about update
export output=`/usr/local/uvscan/uvscan --version`
mail -s "VIRUS SIGNATURE FILES UPDATED" $mailto <<eoi

Date:   $tstamp
The virus signature files on $hostname
have been updated.

$output

eoi

exit 0
LJ Archive