Pages

Wednesday, November 26, 2014

ping a host until it responds, then play a sound, then exit

$ speakwhenup() { [ "$1" ] && PHOST="$1" || return 1; until ping -c1 -W2 $PHOST >/dev/null 2>&1; do sleep 5s; done; espeak "$PHOST is up" >/dev/null 2>&1 }

espeak needs to be installed.




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/1Fr53eE

No comments:

Post a Comment