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? TIA. -- Jeremy
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
On 12/5/07 3:58 AM, "Kevin Van Vechten" <kvv@apple.com> wrote:
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.
I've thought about having multiple schedules, but haven't tried it. What about mixing a StartCalendarInterval with StartInterval? Or any of the *Interval keys with WatchPaths or QueueDirectories? Can that also be done, and if so are their differences between Tiger and Leopard? Just curious. Thanks! -- Jeremy
On Dec 5, 2007, at 7:02 AM, Jeremy Reichman wrote:
On 12/5/07 3:58 AM, "Kevin Van Vechten" <kvv@apple.com> wrote:
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.
I've thought about having multiple schedules, but haven't tried it.
What about mixing a StartCalendarInterval with StartInterval? Or any of the *Interval keys with WatchPaths or QueueDirectories? Can that also be done, and if so are their differences between Tiger and Leopard? Just curious.
Launchd logically ORs all criteria. The differences between Tiger and Leopard can be vast or inconsequential depending on your perspective. The single largest "features" that launchd added were: 1) per-user/per-session launchd magic. 2) Mach support 3) Conditional KeepAlive logic. davez
participants (3)
-
Dave Zarzycki
-
Jeremy Reichman
-
Kevin Van Vechten