[launchd-dev] Daemon & Network Availability?
Karl Moskowski
kolpanic at voodooergonomics.com
Mon Nov 10 08:09:34 PST 2008
Hello, all!
I'm working on a project comprised of a launchd daemon and a GUI
client app. I used the BetterAuthorizationSample project as a template
for installing and starting up the daemon the first time. In the
daemon's start-up code, it connects to a remote server. It all works
fine on installation. However, when I reboot my computer, the daemon
starts up, but the network isn't available yet, and the connection
fails.
I tried using SystemConfiguration notifications to receive changes to
the network state, but that doesn't work - the computer has an IP
address at that point, but the remote server is still not reachable. I
also tried setting the KeepAlive option in the daemon's plist to
NetworkState = true. However, that doesn't seem to work either - it
just starts as KeepAlive = true.
Is there some other way to indicate a dependency on the network? Do I
need a delay at start up to wait for a connection? For better or
worse, I used a named DO connection to handle IAC between the daemon &
GUI. Could this be part of the problem (the caveats in TN2083 lead me
to believe it's just inadvisable but not wrong outright)? Also, is
launchd checkin, etc., required? I did have it in main(), but it kept
failing, even though I had ServiceIPC = true. In case it helps, the
current daemon plist is below.
Thanks.
----
Karl Moskowski <kolpanic at voodooergonomics.com>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<true/>
</dict>
<key>Label</key>
<string>com.company.myd</string>
<key>ProgramArguments</key>
<array>
<string>/Library/PrivilegedHelperTools/com.company.myd</string>
</array>
</dict>
</plist>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2441 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20081110/dfca3078/attachment.bin>
More information about the launchd-dev
mailing list