This shows you the differences between two versions of the page.
— |
tips:beep-when-host-starts-pinging [31.08.2011 00:22] (current) vergo created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Beep when host starts pinging ====== | ||
+ | This script will make the PC start beeping with the PC speaker when the selected host becomes pingable. It's useful for example when you are waiting for some server to come online and don't want to keep looking a terminal full of ping timeouts. Remember to check first that the //beep// command actually causes some noise. | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | if [ $# -eq " | ||
+ | beep -f 3000 -l 50 | ||
+ | for (( ; ; )) ; do | ||
+ | pin=`ping -c 1 -w 1 " | ||
+ | if [ $pin -eq 1 ]; then | ||
+ | beep -f 3000 -l 50 | ||
+ | echo "* `date +%H:%M:%S` online!" | ||
+ | else | ||
+ | echo "`date +%H:%M:%S` timeout" | ||
+ | fi | ||
+ | sleep 2 | ||
+ | done | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | </ |