Created
December 1, 2017 16:09
-
-
Save sushain97/a8551fbc4691d8c2fdb760f75cf2b224 to your computer and use it in GitHub Desktop.
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/sh | |
wget https://upload.wikimedia.org/wikipedia/commons/3/33/Dial_up_modem_noises.ogg -O dial_up.ogg --no-clobber --quiet | |
online=true | |
while true | |
do | |
now_online=false | |
if ping -c 1 google.com >> /dev/null 2>&1; then | |
now_online=true | |
fi | |
if ! $online && $now_online; then | |
date +"%F %R | connection is back up" | |
ogg123 dial_up.ogg --skip 1 --end 17 --quiet --ntimes 1.5 | |
fi | |
if ! $now_online && $online; then | |
date +"%F %R | connection went down" | |
fi | |
online=$now_online | |
sleep 3 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment