Skip to content

Instantly share code, notes, and snippets.

@lnostdal
Last active April 25, 2016 16:41
Show Gist options
  • Save lnostdal/8821107b26cd4d02e466 to your computer and use it in GitHub Desktop.
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
#!/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
@lnostdal
Copy link
Author

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..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment