Last active
August 29, 2015 14:18
-
-
Save 0xjairo/efafb0f5d35571249373 to your computer and use it in GitHub Desktop.
Send notification when ping to $SERVER succeeds
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 | |
# exit on no argument | |
[[ -z "$1" ]] && exit 1 | |
SERVER=$1 | |
while true; | |
do | |
# ping: try once, timeout at 2 seconds | |
ping -c1 -W2 $SERVER && notify-send "$SERVER is alive\!" && break; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment