Skip to content

Instantly share code, notes, and snippets.

@0xjairo
Last active August 29, 2015 14:18
Show Gist options
  • Save 0xjairo/efafb0f5d35571249373 to your computer and use it in GitHub Desktop.
Save 0xjairo/efafb0f5d35571249373 to your computer and use it in GitHub Desktop.
Send notification when ping to $SERVER succeeds
#!/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