tags:

views:

103

answers:

3

Hi,

I need to run a script on my Mac when network connection changes, i.e. when network cable/wifi gets connected or disconnected. I do not want to use a cronjob and I'd prefer a soulution that avoids modifying system files. Is there some "network changed" hook in the mac os x I could connect on?

thanks, Bob

A: 

While not directly what you ask for, maybe columbus can be made part of the solution? It uses ARP traffic to help cope with a machine that for instance travels within school/home/work etc and should have correspondingly different /etc/resolv.conf or firewall settings etc.

From the README file:

columbus : an automatic network detector and configurator

columbus is useful when you use your machine in different networks. It is great for laptop users.

columbus uses ARP pings to look for known MAC-IP address correspondences. It can do this even when no IP address has been assigned yet, which is a good idea when you are on a new network.

columbus can be hooked up to your network script. It can also be hooked up to your apmd and be told to re-check the network each time the computer wakes up.

columbus also has a modified version of one of Donald Becker's link check tools. This way it will check your network when your network cable is plugged back in and if necessary, execute all synchronisation steps.

hlovdal
Not useful on MacOS.
bmargulies
A: 

See this question and answer on superuser.

bmargulies
+1  A: 

Try MarcoPolo, though if you're running Snow Leopard, you'll probably need to look at the bottom of that page for the link to a patched version.

John Yeates