Hi Stolee
On 07/08/2023 19:51, Derrick Stolee via GitGitGadget wrote:
From: Derrick Stolee <derrickstolee@xxxxxxxxxx>
+ switch (schedule) {
+ case SCHEDULE_HOURLY:
+ schedule_pattern = xstrfmt("*-*-* *:%02d:00", minute);
+ break;
+
+ case SCHEDULE_DAILY:
+ schedule_pattern = xstrfmt("*-*-* 0:%02d:00", minute);
+ break;
+
+ case SCHEDULE_WEEKLY:
+ schedule_pattern = xstrfmt("Mon 0:%02d:00", minute);
+ break;
This is not a new issue with this patch but we run the hourly job even
when we want to run the daily job or the weekly job and we run the daily
job when we want to run the weekly job. maintenance_run_tasks() contains
if (hold_lock_file_for_update(&lk, lock_path, LOCK_NO_DEREF) < 0) {
/*
* Another maintenance command is running.
*
* If --auto was provided, then it is likely due to a
* recursive process stack. Do not report an error in
* that case.
*/
if (!opts->auto_flag && !opts->quiet)
warning(_("lock file '%s' exists, skipping maintenance"),
lock_path);
free(lock_path);
return 0;
}
So only one of these jobs will succeed. The cron entries are careful to
only run one job at a time, I think it would be worth doing the same
thing here. I think the using the following format strings would fix this.
Hourly: "Tue..Sun *-*-* 1..23:00:%02d"
Daily: "Tue..Sun *-*-* 00:00:%02d"
Weekly: "Mon *-*-* 00:00:%02d"
It looks like the launchctl schedule has the same issue.
One thing I've been wondering about which is related to maintenance but
totally off-topic for this patch is that I think when auto maintenance
is enabled we stop automatically running "gc" so how do the reflogs get
expired?
Best Wishes
Phillip