[launchd-dev] The "daemons must live for at least 60 seconds" factoid
Kevin Van Vechten
kvv at apple.com
Wed Aug 19 10:16:38 PDT 2009
In general, launchd does not relaunch processes which exit successfully.
It would help if you shared the relevant portions of your launchd plist.
Kevin
On Aug 19, 2009, at 5:16 AM, Jonathan del Strother wrote:
> It's a commonly repeated piece of folklore that if your launchdaemon
> completes in under 60 seconds, launchd will assume it has crashed and
> will re-launch it. I have a LaunchAgent with a 2 minute
> StartInterval, which exits quickly if there are no available jobs for
> it to work on. launchd tends to run it once due to the StartInterval,
> then again 15 seconds later - presumably because it didn't live for at
> least 60 seconds. Adding "sleep(60)" to the end of my LaunchAgent
> seems to prevent it from launching the 2nd time around.
>
> However, I can't find any actual documentation that mentions this,
> and I'm sure I've heard somewhere that it was a Tiger bug/feature
> only, due to be fixed in Leopard - this appears to not be the case.
> It seems an odd feature, too - why relaunch something that exited with
> a successful status code?
>
> Is there any official documentation of this behaviour?
>
> -Jonathan del Strother
More information about the launchd-dev
mailing list