disk_check_advance.sh
#!/bin/ksh
var=`df -a|grep home|tail -1|awk '{print $3}'`
HOST=`hostname`
echo $var1
if [ $var -le 3000000 ]; then
df -h|grep home >data
# du -s /home/* 2>/dev/null| sort -rn |head -20>>data
# cat data|
# mail -s "Alert: Almost out of disk space on $HOST" umesh.prasad@fedex.com
while read line; do
ED=`echo $line|cut -d "/" -f3`
ID=`echo $line|cut -d "/" -f3|cut -c1`
if [ "$ID" == "f" ]
then
ID1=`echo $ED|cut -c2-`
`echo $line | mail -s "Alert:Almost out of Disk space on $HOST" $ID1@fedex.com`
else
ID1=`echo $ED|cut -c3-`
`echo $line | mail -s "Alert:Almost out of Disk space on $HOST" $ID1@fedex.com`
fi
done < data
fi