Return to Snippet

Revision: 1007
at August 28, 2006 10:36 by sudarkoff


Initial Code
One that just checks a random IP on the internet to see if we have internet access:
Code:	

shopt -s extglob
GW=216.239.32.10
IFS=''
PING=`ping -c1 -n -t5 -o $GW`
RC=$?
if [ $RC -eq 2 ]; then
   echo "Internet ($GW) no reply"
   exit 1
fi
RT=$( echo $PING | head -n2 | tail -n1 | awk -F= '{print $4}' )
echo "Internet ($GW) $RT"
exit $RC

Initial URL
http://projects.tynsoe.org/phpBB2/viewtopic.php?p=745

Initial Description

                                

Initial Title
Ping random IP to see if there's connection

Initial Tags
Bash

Initial Language
Other