Created
June 28, 2018 00:59
-
-
Save jotson/531b7705a8311ff643e0946266e6e249 to your computer and use it in GitHub Desktop.
Ping that beeps for Ubuntu
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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependencies
apt install sox
apt install libsox-fmt-mp3
And you need some sound files. Put the paths in
UPSOUND
andDOWNSOUND
Usage
bping google.com