Last active
June 10, 2019 06:16
-
-
Save TheYarin/a9c3a11c3c0c400e1f361a934608ea5a to your computer and use it in GitHub Desktop.
Log internet connection failures
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
#!/bin/bash | |
# Hit Ctrl+C a lot of times to stop | |
# Ping google's 8.8.8.8 DNS server | |
while true; do | |
timeout 1 ping -q -c 1 8.8.8.8 > /dev/null && echo $(date +%Y/%m/%d_%H:%M:%S) GOOD && sleep 1 || echo $(date +%Y/%m/%d_%H:%M:%S) NO INTERNET; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment