the machine that goes PING!

Meet ~bin/sonar.
# usage: sonar <host or ip address>
while :
ping -c 1 $1 && say "PING!"
sleep 30
This is a super fancy network monitoring tool. The original version of this was from another friend named Mark (not he of greenbar fame) and it played a submarine style sonar "ping" sound when a ping was successful. When you're waiting for your server to come back up, and you have time for a nap until it does, a tool like this is just what you need.

This version relies on the Mac OS X /usr/bin/say command.

Eat your heart out peep.

EDIT: Yeah, as originally posted the ping command was missing an argument. I blame myself and blogger's difficult to use posting. Thanks, Aaron.


Cory said...

On Ubuntu, use apt-get install beep and you can beep instead, since say is missing. Sometimes simple ideas are best.

Aaron said...

Very cool.

I noticed one argument was missing when I tried it... Instead of:

ping -c $1 && say "PING!"


ping -c 1 $1 && say "PING!"

Thanks again.

dne said...

Ping has an "audible" flag, so an alternative to your script would be:

ping -i 30 -a host.example.com

Morlockhq said...

On ubuntu,

Install festival and the festvox-don default voice file.

ping -c1 $1 && $(echo "Ping" | festival --tts)

very cool.

The voice isn't that great, but it is still cool.

Does anybody know how to get a better default voice working on festival on ubuntu?

MorlockHQ said...

I almost forgot, you also have to put the following in your .festivalrc file:

(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)

Anonymous said...

Just so you know, the osx ping allows you to beep on a successful ping or beep on a failed ping. Set your alert sound to a sonar ping and... =)

The args are -A and -a. I forget which, since I'm not at my mac right now...