/ Published in: Other
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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
URL: http://projects.tynsoe.org/phpBB2/viewtopic.php?p=745
Comments
 Subscribe to comments
                    Subscribe to comments
                
                