Listing 3: fss_daily--Runs every night to compare du files
#!/bin/sh
# fss_daily:
# This script runs every night to compare the du files from
# tonight with the du files from yesterday
# This script is invoked from du_daily
# Usage: fss_daily mail_to reporttype yymmdd fs_to_comp....
DUMASTER="$1"
REPORTTYPE="$2"
EXT="$3"
shift 3
AFS=$*
# for every du-file compare and send mail
(
echo Subject: fss voor $EXT
for fs in $AFS
do
echo "=======================>> $fs"
today=$EXT.$fs
yesterday=`ls *.$fs | awk '
$1 =="'"$today"'" { print toen }
{ toen = $1 }
'`
./fss.sh "$REPORTTYPE" -o $yesterday -n $today
done
) | mail $DUMASTER
# clean up current dir
if test ! -d olddates
then
mkdir olddates
fi
# Move today's and yesterday's files to olddates,
# then get today's file back
# (They are tomorrow's yesterday files)
mv [0-9][0-9][0-9][0-9][0-9][0-9].* olddates
mv olddates/$EXT.* .
# compress files in olddates
cd olddates
compress `ls | grep '[^.][^Z]$'`
|