I am working on a script to check the var on all of my systems. Can someone help me fix it to work better or give me suggestions.
#!/bin/ksh
IN=/path/to/list_of_workstations.txt
while read hostnames
do
if ping $hostnames 1 | grep alive > /dev/null
then
percent=`ssh -q -n $hostnames df -hk | grep "/var$/ | awk '{print $5}'`
echo $hostnames $percent
fi
done <$IN
tail -f /dev/null # This is so the window doesnt close
The df command can take the filesystem as a parameter. You'll probably want to get rid of the heading line. I don't have the same version of "df" as you (many don't have "-h") so it's a guess that the heading contains the string "avail".