Last active
April 25, 2016 16:41
-
-
Save lnostdal/8821107b26cd4d02e466 to your computer and use it in GitHub Desktop.
Simple Linux shell script to make a looping sound as long as your Internet connectivity is down
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 | |
## NOTE: Make sure `bell.oga' actually exists and adjust accordingly. | |
for (( ; ; )) | |
do | |
ping -w 5 -c 1 8.8.8.8 &> /dev/null | |
if [ $? -ne 0 ]; then | |
paplay /usr/share/sounds/freedesktop/stereo/bell.oga | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A different version of this using HTTPS/TLS is here: https://github.com/lnostdal/nostdal-stuff/blob/master/ping_alarm.sh
(..tho I wouldn't rely on my server being up 100% of the time..)