Blog of Wade Making Connexions



OS X Command Line Fun With Growl

Growl is a lot of fun on OS X. Once installed, a lot of applications become a lot more visible, in a good way. Notifications for things you want to know about. It’s very easy to add or remove programs from the list. You can even use Growl for remote monitoring over IP, not that I would for anything important.

What I’ve been struggling with is rebooting a server. I want to know when it’s come back up, but I didn’t want to keep having to command+tab over to Terminal. After a bit of extensive googling, or perhaps just bad queries, I found what I was after.

Gratuitous-ARP:~ wadem$ sh
sh-3.2$ while ! ping -c 1 -t 100; do sleep 3; done; growl .21 is online

What this does is it sends 1 packet, to and looks for a timeout of less than 100ms. If this does not happen, IE while !, sleep for 3 seconds, then loop again. To break the loop and reach the done, the machine needs to be online. When the machine is online, growl1 is used to send a message. Simple :)

And to think I’d be holding off using Growl for so long, and that it only snuck onto my system with Adium, some more awesome software.

  1. The growl called here is a script, not the program. The script calls the program. You can get the script here, with more examples.

No Comments Yet

There are no comments yet. You could be the first!

Leave a Comment

Today’s XCKD, Blowing Me Away!!!! Google on Australian Broadband Future