If you work on multiple servers and want to check what hosts are
up/down then you can use the below shell script to test multiple
servers connectivity ::
#!/bin/bash
# test1.txt should contain a list of IP's to be tested
for i in `cat test1.txt`;
do
ping -c 1 -W 1 $i &> /dev/null
if [ $? -ne 0 ]; then
#use if [ $? -eq 0 ]; then to test the up IP's
echo "$i is down"
fi
done
No comments:
Post a Comment