Skip to content

Instantly share code, notes, and snippets.

@nand0p
Last active August 29, 2015 14:08
Show Gist options
  • Save nand0p/df56d2a52527c57793f0 to your computer and use it in GitHub Desktop.
Save nand0p/df56d2a52527c57793f0 to your computer and use it in GitHub Desktop.
dig test internet connection
#!/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