I am writing a script to pull diskspace information from our servers. Here is the script that I wrote:
#!/bin/ksh
for host in `cat /oper/hosts/esc.misc`
do
ssh -q -o ConnectTimeout=10 operator@$host df -h|grep "/dev/" |egrep '8[
0-9]%|9[0-9]%|100%' | awk '{print H " " "at " $5 " with " $4 " free " " on mount
" $6}' H=$host
case $? in
0)
echo "=========== $host worked ==============="
;;
* )
echo "=========== $host failed ==============="
;;
esac
done
The problem is that I know one of the servers in my list is down yet it still shows up in the case statement as working. I'm not sure why this is happening? Do any of you scripting gods see something that I am missing?
Thanks
Robert