Created
March 7, 2014 04:41
-
-
Save kithokit/9405358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
MAXRETRY=50 | |
count=0 | |
ping -W3 -c1 www.google.com > /dev/null 2>&1 | |
while [ $? -ne 0 ]; do | |
#statements | |
if [ "$count" = "$MAXRETRY" ]; then | |
echo "No network found outside to Internet" | |
exit 1 | |
fi | |
echo "Retry the network times: $count" | |
count=$((count + 1)) | |
sleep 1 | |
ping -W3 -c1 www.google.com > /dev/null 2>&1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment