Can somebody help me w/ my ping script: It works until it hits a bad IP - then locks up and doesn't write to my bad file - I just want a script that pings a list of IP's (ie clt.txt) and creates a list of failed devices...
#!/bin/sh
while read HOST
do
ping $HOST -n 2 > /users/bastir/tempfile.txt
if grep ! /users/bastir/tempfile.txt
then
echo "cannot ping $HOST successfully" >> /users/bastir/pingbad.txt
else
echo "can ping $HOST successfully" >> /users/bastir/pinggood.txt
fi
done < /users/bastir/clt.txt
#!/bin/sh
while read HOST
do
ping $HOST -n 2 > /users/bastir/tempfile.txt
if grep ! /users/bastir/tempfile.txt
then
echo "cannot ping $HOST successfully" >> /users/bastir/pingbad.txt
else
echo "can ping $HOST successfully" >> /users/bastir/pinggood.txt
fi
done < /users/bastir/clt.txt