Listing 4: fsd
#!/bin/sh
#
# filesystem.hourly
#
# filesystem-related operations done once per hour
#
NOTIFY=ables@hal.com # who to tell if we find something
MAILER=/usr/ucb/mail # use this mailer to send
HOST=`hostname`
TMP=/tmp/fs.$$
rm -rf $TMP
touch $TMP
/usr/local/cron/duck >> $TMP # check user totals
/usr/local/cron/dfck >> $TMP # check fs capacity
/usr/local/cron/mboxck >> $TMP # check mail spool dir
if [ -s $TMP ]; then # if output was produced
$MAILER -s "filesystem hourly check on $HOST" $NOTIFY <$TMP
fi
rm -f $TMP
|