[launchd-dev] An agent with Keep-Alive set to true (in this agent's plist)

Nick eveningnick at gmail.com
Thu Jun 9 14:04:28 PDT 2011


Hello!
I would like to have my application launched all the time - even when user
makes it quit, it relaunches itself (this is a kind of child protection
system).

OS X has exactly what i need - an agent, with Keep-Alive set to "true" in
this agent's .plist file (i chose agent - because i need an interface for
this application).

The problem is when the system tries to quit (reboot/shut down), my agent
"cancels the shut down" (it behaves exactly like i'd return "NO" in
-applicationWillClose method of the Application delegate, except the fact
that i am not returning anything there).
I tried to set up "throttle respawn" time for the agent to 20 seconds in a
plist file (it is not necessary for the agent to be restarted immediately
after 1 second for me), but (as it seems) the "respawning" happen not
necessarily in 20 seconds, but within 0-20 seconds interval. Which leads
again to "the application MyAgent has cancelled the restart" when i want to
shut down the machine.
Is there any way to solve this issue?

Thank you
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20110610/f8c0a6c4/attachment.html>


More information about the launchd-dev mailing list