[launchd-dev] Disabling of launchd job if program is missing

Dreamcat4 dreamcat4 at gmail.com
Tue Jul 6 13:31:29 PDT 2010


On Tue, Jul 6, 2010 at 7:54 PM, Jerry Krinock <jerry at ieee.org> wrote:
>
> On 2010 Jul 06, at 10:57, Damien Sorresso wrote:
>
>> launchd doesn't know that the needed resource won't come online in the future, so it keeps trying. We used to automatically disable jobs if they failed to run a certain number of times. This didn't really help anyone and in fact made life harder if your binary lived on a network volume that didn't get mounted right away.
>
> Thank you for the history, Damien.  Indeed, in some cases, as in the example you mentioned, we wouldn't want launchd to simply forget the job after a few tries.  But even in your example case, say if the user is working "off line" for five hours, they're going to see this message logged in their Console every ten seconds -- that's 5*60*6 = 1800 log messages.
>
> Of course, using a trampoline program and an uninstaller are solutions, and are currently required by developers.  But since we all need to do the same thing, some "LaunchFail" parameters in launchd.plist(5) would be very helpful.  For example, there might be several "backoff" algorithms from which to choose, with parameters to set, and a parameter stating whether and how to notify the user.  Would anyone else like me to file a bug?

Having a backoff algorithm is a cool idea. However (and I have
investigated this very thoroughly):

Any worthwhiile backoff scheme would be significantly more complex to
implement and serve as more of a luxury than a necessity. Theres not
as much call for it. Usually those things can be programmed around in
some other way that is "not-as-good-but-still-good-enough".

However for the "trampoline" mechanism or whatever you want to callit.
That would definately be well worth adding to launchd. With a boolean
plist key to enable / disable it. Absolutely great stuff. It's the
best solution for the OP's problem and stops everyone else having to
write awkward uninstaller programs too.

Of course, that would (at earliest) only come into effect OS X 10.7.
Question: Patches welcome?

>
> Jerry
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>


More information about the launchd-dev mailing list