maintenance: fix launchctl calendar intervals

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@gmail.com>
Acked-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
main
Josh Heinrichs 2025-04-20 23:46:33 -06:00 committed by Junio C Hamano
parent f93ff170b9
commit eb2d7beb0e
1 changed files with 2 additions and 2 deletions

View File

@ -2061,7 +2061,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit

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";
@ -2072,7 +2072,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
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",