Anyone familiar with launchd
on Mac OS X, specifically the NetworkState
(bool
) key in KeepAlive
section of a .plist
file?
From the man
pages, launchd
should call an executable when there is no network connectivity on the Mac, when the plist is configured like this:
...
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<false/>
</dict>
...
This seems to work okay, However, once a valid network connection is established (defined as the Mac having at least one non-loopback IPv4/6 address), launchd
should stop calling the executable (because the NetworkState
flag should prevent it).
The behavior I am seeing, though, is that launchd
keeps calling my program regardless of the Mac's network connectivity! It’s as if launchd
is completely ignoring the NetworkState
flag.
Does anyone know how to make this work so that launchd
will only call a program when there’s no network connection, and stop calling it once a network connection is established?