Thanks for the reply - turns out that it's being relaunched because launchd thinks one of the watch paths changed. I'm not sure why - to the best of my knowledge it's been read from, but not written to - but at least it clears up one mystery. It's actually monitoring a sqlite database - maybe sqlite is invisibly writing to it behind the scenes, I'll see if I can find anything with instruments... On Wed, Aug 19, 2009 at 6:16 PM, Kevin Van Vechten<kvv@apple.com> wrote:
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