[launchd-dev] launchd - how to specify daemon needs to wait for network to start?

Jim Correia jim.correia at pobox.com
Tue Apr 22 07:19:11 PDT 2008


I'm upgrading a server from 10.4 to 10.5 server. This server runs p4d  
(which really wants to listen/fork itself - there are restrictions on  
(x)inetd compatibility mode), and a handful of other jobs which should  
only be running after the p4d daemon has started.

Currently, the launchd job is specified like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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.perforce.p4d</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/p4d</string>
		...
	</array>
</dict>
</plist>

It appears that p4d is first launched before the network interface is  
up. (The error information in the log isn't extremely verbose. It  
looks like it is trying to bind to the address in the license file,  
and this fails.) After one or more respawn attempts, the server comes.

What is the correct way to spec the job?

Jim


More information about the launchd-dev mailing list