Script Gurus,
Need your help in getting this script to come out of logical error : I have pasted the script below: This script finds disk utilzation ... the script is written for both AIX and SUN OS... and option will be given in the initial to select DB or Non DB... its required for my prj... Please advice where I went wrong.... the disk space part is not coming correctly in the script.... but if executed on shell it works..... I think problem is in if elif..... need your advice:
echo "Is it a DB Host? (Y/y/N/n)"
read YN
if [ "$optYN" != "n" -a "$optYN" != "N" ]
then
echo "Please enter the hostname"
read Hname
echo "Status of Disk Space\c "
HOST_ENV=`uname`
Host_SUN="SunOS"
Host_AIX="AIX"
if [ "${HOST_ENV}" = "${Host_AIX}" ]
then
df -k |awk '{print \$4}'|grep %|awk -F'%' '{print \$1}'|sed -e 's/^ *//'|sed -e '/^$/d'|while read LINE
do
threshold=90
if [ $LINE -gt $threshold ]
then
echo "Value exceeded for df -k|grep $LINE\%|awk '{print \$7}'echo "\c----->$LINE\c"
fi
done
elif [ "${HOST_ENV}" = "${Host_SUN}" ]
then
df -k|awk '{print \$5}'|grep %|awk -F'%' '{print \$1}'|sed -e 's/^ *//'|sed -e '/^$/d'|while read LINE
do
threshold=90
if [ $LINE -gt $threshold ]
then
echo "Value exceeded for df -k|grep $LINE\%|awk '{print \$6}'echo "\c ----> $LINE\c"
fi
done
else
echo "Disk Space Under threshold!!"
fi