[launchd-dev] WatchPaths jobs just quit working sometimes. If program exits nonzero status?

Jerry Krinock jerry at ieee.org
Tue Jan 31 00:16:32 PST 2012


I support and test an app that uses the WatchPaths trigger in a launchd job.  About once a month, I find that a WatchPaths trigger will *just stop working*.  Running 'launchctl list', I see that my job is still loaded.  The throttle interval is 60 seconds, and my program has exited.  Yet I can wait many minutes, touch the WatchPath repeatedly, but launchd just ignores it.  If I simply unload the job, then reload the job, it always starts working again.

Has anyone ever seen this behavior besides me?  The last couple times it's occurred, I've noted that the previous time my program was launched, it had exited with nonzero status.  This is indicated in the output of 'launchd list'.

Further tests indicate that exiting with nonzero status is not sufficient to cause the WatchPaths trigger to stop working.

But I'm thinking that it may be a necessary condition, and so I'm going to modify my program to always exit with 0 status.  I report errors by other means anyhow.

Thanks for any comments on this.  Is there any way to get more debugging info out of launchd?

Jerry Krinock



More information about the launchd-dev mailing list