3

I have a job that needs to run every hour between 09:00-15:00 M-F. How do I do that in a launchd plist file?

3

You'll have to explicitly create a record for every hour from 9 to 15 for every day from Monday to Friday: 35 records. The cron utility has a far more compact format. With it your use case would be written as 0 9-15 * * 1-5. LaunchControl is a utility which creates launchd StartCalendarInterval records from cron time descriptions:

enter image description here

  • That's what I was afraid of. – DrStrangepork May 11 '17 at 13:23
  • Thanks for the lead on LaunchControl! I've been using Lingon-X. I like LaunchControl more! – DrStrangepork May 11 '17 at 13:39
  • FWIW, here is the scripted solution for the StartCalendarInterval array to create the schedule: for ((day=1;day<=5;day++)); do for ((h=9;h<=15;h++)); do echo "<dict> <key>Hour</key> <integer>$h</integer> <key>Minute</key> <integer>0</integer> <k ey>Weekday</key> <integer>$day</integer> </dict>"; done; done. Pasted that output to the <array> of the StartCalendarInterval array, saved, and voila – DrStrangepork May 15 '17 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .