Re: Why does launchd keep running my server after it quits?
Re: Why does launchd keep running my server after it quits?
- Subject: Re: Why does launchd keep running my server after it quits?
- From: Axel Luttgens <email@hidden>
- Date: Mon, 18 Jul 2011 18:36:06 +0200
Le 18 juil. 2011 à 02:55, email@hidden a écrit :
> 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?
Hello,
For the latter, I think it's more an artifact of the output of "launchctl list" than anything else.
> 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?
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden