#!/usr/bin/ksh
WORKFILE="/tmp/df.work" # Holds filesystem data
$WORKFILE # Initialize to empty
OUTFILE="/tmp/df.outfile" # Output display file
$OUTFILE # Initialize to empty
THISHOST=
1 | 1` |
hostname
1 | 1` |
# Hostname of this machine
MIN_MB_FREE="50MB" # Min. MB of Free FS Space
df -k | tail +2 | egrep -v '/cdrom' /
| awk '{print $1, $4, $6}' > $WORKFILE
# Format Variables
(( MIN_MB_FREE = $(echo $MIN_MB_FREE | sed s/MB//g) * 1024 ))
# Loop through each line of the file and compare column 2
while read FSDEVICE FSMB_FREE FSMOUNT
do
FSMB_FREE=$(echo $FSMB_FREE | sed s/MB//g) # Remove the "MB"
if (( $FSMB_FREE < $MIN_MB_FREE ))
then
(( FS_FREE_OUT = $FSMB_FREE / 1000 ))
echo "$FSDEVICE mounted on $FSMOUNT has ${FS_FREE_OUT}MB Free" /
>> $OUTFILE
fi
done < $WORKFILE
if [[ -s $OUTFILE ]]then echo "/nFull Filesystem(s) on $THISHOST/n" cat $OUTFILE printfi