Tip: Detect Network Connectivity in Bash
There are times that we are required to check hundreds of servers for network connectivity, and what command comes first in mind when testing network – ping. To help out other system and network administrators out there, here is a quick bash script to ping servers.
#!/bin/bash
SERVERS=server.txt
for i in $(cat $SERVERS)
do
ping -c2 $i > /dev/null
if [ $? -ne 0 ]
then
echo "$i is DOWN"
else
echo "$i is UP"
fi
sleep 3
done
Related Posts
Post comment
Search PinoyTux
Subscribe to Email Feeds
Blog Lounge
Popular Posts
Recent Posts
Drop your Card Here
Recent Comments
- Mela
on Cebu Pacific Sucks - madcSPYnX
on AMA Desktop: Linux Made in Philippines - David Fortier
on Cebu Pacific Sucks - David Fortier
on Cebu Pacific Sucks - Mr. Walkman
on Shopping for Mobile Phone: Sony Ericsson Phones Only








