Cover V11, I05
may2002.tar

Listing 1

#!/bin/bash

# /usr/local/bin/get-stat.pl
# Retrieve yesterdays STAT file from e-mail server
# and combine with the two previous days

# Generate the name of yesterdays STAT file and
# set other variables - yyMMMdd.TXT - ie: 01JUL31.TXT
file=$(date +%y%b%d.TXT -d yesterday)
datadir="/home/jsmith"

# Mount the share and retrieve the STAT file
smbmount //<e-mail server>/stats /mnt/mail -o username=jsmith,password=<password>
cp /mnt/mail/$file $datadir/$file
umount /mnt/mail

# Rotate and make combined STAT file for last 3 days
if [ -f $datadir/stat.2 ]; then
   mv -f $datadir/stat.2 $datadir/stat.3
fi

if [ -f $datadir/stat.1 ]; then
   mv -f $datadir/stat.1 $datadir/stat.2
fi

cp $datadir/$file $datadir/stat.1
cat $datadir/stat.1 $datadir/stat.2 $datadir/stat.3 > $datadir/stat.comp