This is a ksh which we run every 15 minutes, it uses a control file, making it more flexible. It runs out of a nfs mounted file and keeps an eye on 9 HP_UX boxes.
FILE01="/tmp/$LOGNAME.temp.bdf.msg1"
FILE02="/tmp/$LOGNAME.temp.bdf.msg2"
FILEcontrol=/tmp/$LOGNAME.temp.bdf.control
rm -f $FILEcontrol
cat /Syst/allow03 | egrep "FILESYSTEM:" >> $FILEcontrol
awk '{OFS=" "} {FS=":"} {print $2 $3 $4 $5}' $FILEcontrol |
while read F2 F3 F4 F5
do
# echo "$F2=$F3=$F4=$F5="
if [ "$(hostname)" = "$F2" ]; then
export MountP="$F3"
export PercentFull="$F4"
export WarningFlag="~"
rm -f $FILE01
rm -f $FILE02
/usr/bin/bdf $MountP > $FILE01
BDF1=$(grep $MountP $FILE01 | cut -c46-47)
if [ "$BDF1" -gt "$PercentFull" ]; then
export WarningFlag="X"
echo "=" > $FILE02
echo "= $(date)" >> $FILE02
echo "=" >> $FILE02
echo "= WARNING !!" >> $FILE02
echo "=" >> $FILE02
echo "= $MountP" >> $FILE02
echo "=" >> $FILE02
echo "= is $BDF1% full" >> $FILE02
echo "=" >> $FILE02
echo "= on $(hostname)" >> $FILE02
echo "=" >> $FILE02
echo "= You may want to schedule a cleanup" >> $FILE02
echo "=" >> $FILE02
cat $FILE02 | /usr/bin/mailx -s "FILE SYSTEM ON $(hostname)" $F5@TFSGATE
fi
fi
done
rm -f $FILE01
rm -f $FILE02
rm -f $FILEcontrol
The control file (allow03) looks like this:
FILESYSTEM - FILE SYSTEM NOTIFICATIONS
FILESYSTEM:HOSTNAME :Mount :%% :NOTIFY
FILESYSTEM:hp01 :/tmp :80 :jbond
FILESYSTEM:hp01 :/tmp :80 :dtracy
FILESYSTEM:hp06 :/u01 :88 :jbond