Skip to content

Instantly share code, notes, and snippets.

@jotson
Created June 28, 2018 00:59
Show Gist options
  • Save jotson/531b7705a8311ff643e0946266e6e249 to your computer and use it in GitHub Desktop.
Save jotson/531b7705a8311ff643e0946266e6e249 to your computer and use it in GitHub Desktop.
Ping that beeps for Ubuntu
#!/bin/sh
UPSOUND=~/Dropbox/phone-sounds/notifications/Trek\ Beep\ 11.mp3
DOWNSOUND=~/Dropbox/phone-sounds/notifications/Trek\ Beep\ 03.mp3
while [ 1 = 1 ]
do
ping -q -c 1 -W 1 $1 >/dev/null
STATUS=$?
echo -n `date`
echo -n " "
if [ $STATUS = 0 ]
then
echo "$1 is UP"
play -q "$UPSOUND"
else
play -q "$DOWNSOUND"
echo "$1 is DOWN"
fi
sleep 2
done
@jotson
Copy link
Author

jotson commented Jun 28, 2018

Dependencies

apt install sox
apt install libsox-fmt-mp3

And you need some sound files. Put the paths in UPSOUND and DOWNSOUND

Usage

bping google.com

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