Skip to content

Instantly share code, notes, and snippets.

@sushain97
Created December 1, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sushain97/a8551fbc4691d8c2fdb760f75cf2b224 to your computer and use it in GitHub Desktop.
Save sushain97/a8551fbc4691d8c2fdb760f75cf2b224 to your computer and use it in GitHub Desktop.
#!/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