[launchd-dev] Run job when network configuration changes

Jeremy Reichman jaharmi at jaharmi.com
Thu Dec 6 06:17:22 PST 2007


On 12/6/07 4:23 AM, "Quinn" <eskimo1 at apple.com> wrote:

> At 1:57 -0500 6/12/07, Edward R. Marczak wrote:
>> How about /Library/Preferences/SystemConfiguration/preferences.plist
> 
> That changes when the network /preferences/ change, not when the
> network state changes.  For example, if someone plugs or unplugs the
> Ethernet, this file won't change.
> 
> What /does/ change is the System Configuration framework "dynamic
> store".  However, I don't know of any good way to hook into the
> dynamic store from a script.  OTOH, it's trivial to do this from C
> code.

I believe this was more or less the gist, minus the C code bit, of this
topic on the MacEnterprise list. We couldn't find a file that always worked,
so Kicker.xml (despite being in the System domain) seemed the option closest
to the action. But, being in the System domain in Tiger, there was
reluctance to edit it, and being gone in Leopard makes it a moot point.

What about a future launchd that could monitor for changes to
SystemConfiguration? What if I could supply a dictionary of paths/keys (i.e.
"State:/Network/Global/IPv4" which I can see when I use "list" with scutil)
I care about, and if any of them are modified, the job fires? It seems like
this could also let me tap into other events I care about, like maybe even
wake/sleep.

Nathan said, "Well since you *can* register for almost any arbitrary SC
change ... [snip]," so I'm just hoping launchd can register for me and I can
edit a plist become a developer.

I'm just trying to lower the bar to make this possible. I may be clearly
flailing here, but I'm still curious. And I'll be filing my requests if I
haven't done already so. :)


-- 
Jeremy




More information about the launchd-dev mailing list