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: email@hidden
- Date: Mon, 18 Jul 2011 20:57:20 -0500
Shantonu Sen wrote:
I don't think one can explain it any better than the launchd.plist(5)
man page (emphasis mine):
KeepAlive <boolean or dictionary of stuff>
This optional key is used to control whether your job is to be
kept con-
tinuously running or to let demand and conditions control the
invocation.
The default is false and therefore only demand will start the
job. The
value may be set to true to unconditionally keep the job alive.
Alterna-
tively, a dictionary of conditions may be specified to
selectively con-
trol whether launchd keeps a job alive or not. If multiple keys
are pro-
vided, launchd ORs them, thus providing maximum flexibility to
the job to
refine the logic and stall if necessary. If launchd finds no
reason to
restart the job, it falls back on demand based invocation. Jobs
that
exit quickly and frequently when configured to be kept alive
will be
throttled to converve system resources.
SuccessfulExit <boolean>
If true, the job will be restarted as long as the program
exits and
with an exit status of zero. If false, the job will be
restarted
in the inverse condition. This key implies that
"RunAtLoad" is set
to true, since the job needs to run at least once before
we can get
an exit status.
Thank you for the reply.
I am not sure I understand what you are suggesting here. The important
part in my situation with respect to the usage of SuccessfulExit is that
RunAtLoad is false. The documentation would seem to indicate that to use
SuccessFulExit, RunAtLoad needs to be true. In my situation, changing
RunAtLoad to true would not be the correct behavior. The server should
only run upon receiving a request from the Client and once the request
is completed, it should stop running (well, unless another request has
come in).
The part which says that "jobs that exit quickly and frequently will be
throttled" shouldn't be what my situation entails for this sample code.
It might exit quickly, but there should be only a single invocation of
the server and it should just stop running.
_______________________________________________
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