[launchd-dev] ~/LaunchAgent + KeepAlive=true = Login Jail
subscriber at gloaming.com
Mon Jan 28 08:05:14 PST 2008
Quinn <mailto:eskimo1 at apple.com> wrote (Monday, January 28, 2008
4:33 AM -0000):
>At 23:16 -0700 27/1/08, James Bucanek wrote:
>>The only difference is that KeepAlive would restart my
>>background app if it crashed. Fortunately (through the
>>brilliant programming efforts of its creator, I'm sure), this
>>particular app simply doesn't crash -- knock on wood.
>One option is to set "KeepAlive" to a dictionary containing
>"SuccessfulExit" set to false. That way, launchd won't restart you if
>you quit cleanly. OTOH, if you crash, you'll be relaunched.
Thanks for the suggestion, Quinn, but it still boils down to
almost the same thing.
I want the process to be restarted if the user or my client
application quits it. The program is a simple background Cocoa
app that displays a single window with status information. It's
really simple and (virtually) never crashes or locks up. It
does, however, sometimes accumulate stale process connections
and such. It's sometime nice to restart it just by telling it to
quit -- either from my client application or by letting the user
quit it using the Activity Monitor.
About the only thing I can think of that might make this work is
to add a function that would cause the application to exit with
a non-zero status and call that when I want to restart it. This
doesn't solve the problem of the user quiting it (becuase that
would use the standard/clean quit request), but that's probably
as close as I'm going to get.
More information about the launchd-dev