Last active
August 29, 2015 14:08
-
-
Save nand0p/df56d2a52527c57793f0 to your computer and use it in GitHub Desktop.
dig test internet connection
This file contains 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
#!/bin/bash | |
while (true); do | |
echo . | |
date | |
x=$(dig @8.8.8.8) | |
if [[ "$x" == *connection\ timed\ out* ]]; then | |
echo ------=====OFFLINE=====------ | |
echo $x | |
ping -c 1 8.8.4.4 | |
dig @4.2.2.2 | |
else | |
echo OK:ONLINE | |
fi | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment