Q: Running a script when AirPort network is found?

Alex Satrapa grail at goldweb.com.au
Thu Oct 11 00:41:42 PDT 2007


I'm getting more and more concerned about my laziness.  I'm not being  
lazy enough.

Every night when I get home, I religiously run my backup script:

1) Wake my MacBook from sleep
2) Open Terminal
3) type in "~/Applications/backup_to Merlin"
4) happily continue on about my business

What I'd love to have happen is:
1) Wake my MacBook from sleep
(magic happens in the background: the Mac sees my home network, and  
once it has an IP address it automatically runs the backup script)

See? I'm not lazy enough - I've been happily acting like a machine  
and repeating a routine action every time I get home!

So... can anyone tell me about a nifty way to get the script to run  
automagically when the wireless network comes online?  ideally, when  
my nominated home network is visible, but any network will do.

 From what I've read of launchd, I can get the script to start at  
some specific time, or in response to some external activity  
(connection to a port, or presence of a file in a nominated directory/ 
folder).

There's some system config cruft relating to "Kicker", which seems  
more oriented at doing "stuff" when interfaces come up and down -  
would it be safe enough to follow the hints from Mac Geekery[1]  
showing how to set up a script to run when the link comes up on an  
interface?  In fact, there's another reference to Kicker at Mac OS X  
Hints[2].

Any better suggestions?

Alex
[1] http://www.macgeekery.com/gspot/2006-05/ 
hacking_kicker_and_configd_to_run_your_scripts
(or http://tinyurl.com/2zx3n3 if that URL got wrapped/broken)
[2] http://www.macosxhints.com/article.php?story=20070517224112286


More information about the MacOSX-admin mailing list