Tuesday, June 2, 2009

The Command to check the disks and strip out unwanted variables

# The Command to check the disks and strip out unwanted variables
DISKSIZES=`df -k |grep / |awk '{print $5}' |sed -e 's/\%//'`


# Take the input from the df command above
for percent in $DISKSIZES
do

# If the percent is greater than the maximum percent that the disk slices are allowed to grow to
if [ $percent -gt $MAXSIZE ]
then

# Mail a df -k to the specified person(s)
echo $percent
df -k | mailx -s "Disk Space Problem on 'nodename' " $ADMIN_MAIL
fi

done

No comments: