Skip to content

Instantly share code, notes, and snippets.

@DomiR
Created June 1, 2014 20:53
Show Gist options
  • Save DomiR/2fe49a84bd807cb162d4 to your computer and use it in GitHub Desktop.
Save DomiR/2fe49a84bd807cb162d4 to your computer and use it in GitHub Desktop.
Beep when online again.
beepwhenup () {
echo 'Enter host you want to ping:'; read PHOST;
if [[ "$PHOST" == "" ]];
then exit; fi;
while true;
do ping -c1 -W2 $PHOST 2>&1 >/dev/null;
if [[ "$?" == "0" ]];
then for j in $(seq 1 4);
do beep;
done;
ping -c1 $PHOST;
break;
fi;
done; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment