Josh Heinrichs <joshiheinrichs@xxxxxxxxx> writes: > When using the launchctl scheduler, the weekly job runs daily, and the > daily job runs on the first six days of each month. This appears to be > due to specifying "Day" in the calendar intervals, which according to > launchd.plist(5) is for specifying days of the month rather than days of > the week. The behaviour of running a job on the 0th day is undocumented, > but in my testing appears to be the same as not specifying "Day" in the > calendar interval, in which case the job will run daily. > > Use "Weekday" in the calendar intervals, which is the correct way to > schedule jobs to run on specific days of the week. > > Signed-off-by: Josh Heinrichs <joshiheinrichs@xxxxxxxxx> > --- With a bit wider context, the patch looks like so. As I do not use macOS or launchctl myself, my guess may be way off but please bear with me. > builtin/gc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git i/builtin/gc.c w/builtin/gc.c > index 99431fd467..cc13baa3bd 100644 > --- i/builtin/gc.c > +++ w/builtin/gc.c > @@ -2072,24 +2072,24 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit > for (i = 1; i <= 23; i++) > strbuf_addf(&plist, repeat, i, minute); > break; > > case SCHEDULE_DAILY: > repeat = "<dict>\n" > - "<key>Day</key><integer>%d</integer>\n" > + "<key>Weekday</key><integer>%d</integer>\n" > "<key>Hour</key><integer>0</integer>\n" > "<key>Minute</key><integer>%d</integer>\n" > "</dict>\n"; > for (i = 1; i <= 6; i++) > strbuf_addf(&plist, repeat, i, minute); > break; So we used to say that "we want the task to run on days 1 thru 6 (6 days in total) of a month at certain minute of the day past midnight", which clearly not how people think of "daily" task. Updated one specifies the task to run on day 1 (Monday) thru 6 (Saturday) of a week. The manual page seems to say that day 0 and day 7 of a week are both Sundays. https://www.manpagez.com/man/5/launchd.plist/ look for StartCalendarInterval to read about Day and Weekday. Curious that day 7/0 are ignored. Other schedulers are somewhat inconsistent but generally agree, so I won't worry about changing it in this patch. schtasks_schedule_task() excludes Sundays, and crontab_update_schedule() says that it wants to run daily scheduled tasks on day 1-6. systemd_timer_write_timer_file() however seems to say that it wants to run things on Tue..Sun (excluding Mondays), which may want to be corrected, I dunno. > case SCHEDULE_WEEKLY: > strbuf_addf(&plist, > "<dict>\n" > - "<key>Day</key><integer>0</integer>\n" > + "<key>Weekday</key><integer>0</integer>\n" > "<key>Hour</key><integer>0</integer>\n" > "<key>Minute</key><integer>%d</integer>\n" > "</dict>\n", > minute); > break; This one used to say "run on 0th day of the month", but now it says "run on 0th day of the week", which is on Sundays. Makes sense. Will queue. Thanks.