site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com User-agent: Roundcube Webmail/0.5.2 Axel Luttgens wrote: Le 18 juil. 2011 à 02:55, email@hidden a écrit : Hello, For the latter, I think it's more an artifact of the output of "launchctl list" than anything else. Ya, this is what I figured, but wanted to make sure. Thank you for the information. I added in sleep( 10 ) between the log statements. This changed the output, but the server keeps running. The output in the console now looks like: _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl...
If there is a better mailing list for this question, please let me know.
I've got a sample project at: http://ericgorr.net/pq/CST2.zip
In my system.log, I keep seeing the following output:
Jul 17 20:50:35 Glamdring server[2594]: Hello, the server is here...
Jul 17 20:50:35 Glamdring server[2594]: server_check_in... 5
Jul 17 20:50:35 Glamdring server[2594]: Hello, the server is going away ...
Jul 17 20:50:35 Glamdring com.apple.launchd[1] (net.ericgorr.server): Throttling respawn: Will start in 10 seconds
Jul 17 20:50:45 Glamdring server[2602]: Hello, the server is here...
Jul 17 20:50:45 Glamdring server[2602]: server_check_in... 5
Jul 17 20:50:45 Glamdring server[2602]: Hello, the server is going away ...
Jul 17 20:50:45 Glamdring com.apple.launchd[1] (net.ericgorr.server): Throttling respawn: Will start in 10 seconds
The plist for the server looks likes:
<?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>EnableTransactions</key>
<true/>
<key>Label</key>
<string>net.ericgorr.server</string>
<key>Program</key>
<string>/usr/local/libexec/server</string>
<key>KeepAlive</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>server</string>
<string>launchd</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>Sockets</key>
<dict>
<key>net.ericgorr.server.sock</key>
<dict>
<key>Bonjour</key>
<string>server</string>
<key>SockServiceName</key>
<string>1139</string>
</dict>
</dict>
</dict>
</plist>
However, when I do:
~ $launchctl list net.ericgorr.server
{
"Label" = "net.ericgorr.server";
"LimitLoadToSessionType" = "System";
"OnDemand" = true;
"LastExitStatus" = 0;
"TimeOut" = 30;
"Program" = "/usr/local/libexec/server";
"ProgramArguments" = (
"server";
"launchd";
);
"EnableTransactions" = true;
"TransactionCount" = -1;
"Sockets" = {
"net.ericgorr.server.sock" = (
file-descriptor-object;
file-descriptor-object;
);
};
};
Is there any reason why it replaced my KeepAlive and RunAtLoad keys with the deprecated OnDemand key? The sample project really doesn't do anything yet. It's only purpose
is to get something simple working...connect to a launchd server and
then watch it go away normally. As far as I can tell, your server currently quits immediately; this is
interpreted by launchd as a failure that occurred while launching the daemon (at least, this used to be case). Could you try by inserting a delay of ten seconds or more between your two NSLog() statements? Jul 18 21:45:26 Glamdring server[12831]: Hello, the server is going away ... Jul 18 21:45:27 Glamdring server[12833]: Hello, the server is here... Jul 18 21:45:37 Glamdring server[12833]: Hello, the server is going away ... Jul 18 21:45:37 Glamdring server[12841]: Hello, the server is here... Jul 18 21:45:47 Glamdring server[12841]: Hello, the server is going away ... Jul 18 21:45:47 Glamdring server[12843]: Hello, the server is here... Jul 18 21:45:57 Glamdring server[12843]: Hello, the server is going away ... Jul 18 21:45:57 Glamdring server[12845]: Hello, the server is here... Jul 18 21:46:07 Glamdring server[12845]: Hello, the server is going away ... Jul 18 21:46:07 Glamdring server[12847]: Hello, the server is here... Jul 18 21:46:17 Glamdring server[12847]: Hello, the server is going away ... Jul 18 21:46:17 Glamdring server[12849]: Hello, the server is here... Jul 18 21:46:27 Glamdring server[12849]: Hello, the server is going away ... So, you can see the effect of the call to sleep, but launchd won't let it die. This email sent to site_archiver@lists.apple.com