[launchd-dev] Cross-job coalescing
Kevin Van Vechten
kvv at apple.com
Wed Dec 5 00:58:45 PST 2007
On Dec 4, 2007, at 7:55 PM, Jeremy Reichman wrote:
> I haven't found a way to do this after looking over the docs (but
> not the
> new TechNote) ... I am wondering if there is a way to have two or more
> launchd tasks that call the same script coalesce into the same event
> during
> events like wake from sleep.
>
> For example, what if the same script is called by both a nightly
> job, and a
> weekly job? Are the various instances of the jobs that would have run
> automatically then coalesced into one instance if their scheduled
> execution
> is missed?
>
> Or, if not, is there a way to have some other cross-job identifier
> that is
> shared by multiple launchd jobs so that the same target script is
> not run
> more than once?
Launchd does not run multiple instances of the same job. Instead each
of the criteria listed in the launchd plist is a reason to start the
job only if the job is not already running.
StartCalendarInterval supports an array of dictionaries -- you could
specify both a nightly time and a weekly time in the same plist,
either one of which will cause the job to be run, but not twice when
the nightly and weekly times coincide.
- Kevin
More information about the launchd-dev
mailing list