Help,
I have a basic ping script that works fine - but I can only reference a host file with IP's only:
I would like to follow the IP's w/ a tab and the host name, but my script doesn't like this:
here is my script:
dat=`date +%m%d%y`
while read HOST
do
ping $HOST -n 2 > /users/bastir/tempfile.txt
if grep '100% packet loss' /users/bastir/tempfile.txt
then
echo "cannot ping $HOST" >> /users/bastir/pingbad.$dat
else
echo "can ping $HOST successfully" >> /users/bastir/pinggood.$dat
fi
done < /users/bastir/civdev.txt
my host file is named civdev.txt
I have a basic ping script that works fine - but I can only reference a host file with IP's only:
I would like to follow the IP's w/ a tab and the host name, but my script doesn't like this:
here is my script:
dat=`date +%m%d%y`
while read HOST
do
ping $HOST -n 2 > /users/bastir/tempfile.txt
if grep '100% packet loss' /users/bastir/tempfile.txt
then
echo "cannot ping $HOST" >> /users/bastir/pingbad.$dat
else
echo "can ping $HOST successfully" >> /users/bastir/pinggood.$dat
fi
done < /users/bastir/civdev.txt
my host file is named civdev.txt