ping code example
Example 1: ping
Packet Internet Network Groper. Used to test the reachability of network devices.
Example 2: ping
pong (NOW GO LOOK UP "PONG")
Example 3: ping
ping google.com
Example 4: ping
#!/bin/bash
HOSTS="cyberciti.biz theos.in router"
COUNT=4
for myHost in $HOSTS
do
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then
# 100% failed
echo "Host : $myHost is down (ping failed) at $(date)"
fi
done