On 8/26/2020 11:30 AM, Derrick Stolee wrote: > Let users specify a schedule frequency among this list: hourly, daily, > weekly, monthly. We then set the following* crontab: > > 0 * * * * git for-each-repo --config=maintenance.repos maintenance run --scheduled=hourly > 0 0 * * * git for-each-repo --config=maintenance.repos maintenance run --scheduled=daily > 0 0 * * 0 git for-each-repo --config=maintenance.repos maintenance run --scheduled=weekly > 0 0 0 * * git for-each-repo --config=maintenance.repos maintenance run --scheduled=monthly > > *Of course, there is some care around "$path/git --exec-path=$path" > that I drop for ease here. Jeff Hostetler pointed out the following details in the crontab documentation [1]: Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclusive. For example, 8-11 for an 'hours' entry specifies execution at hours 8, 9, 10, and 11. The first number must be less than or equal to the second one. [1] https://man7.org/linux/man-pages/man5/crontab.5.html This means we could try this schedule: 0 1-23 * * * git for-each-repo --config=maintenance.repos maintenance run --scheduled=hourly 0 0 * * 1-6 git for-each-repo --config=maintenance.repos maintenance run --scheduled=daily 0 0 1-30 * 0 git for-each-repo --config=maintenance.repos maintenance run --scheduled=weekly 0 0 0 * * git for-each-repo --config=maintenance.repos maintenance run --scheduled=monthly And it should behave this way: Run --scheduled=hourly every hour, except at midnight. This runs all "hourly" tasks. Run --scheduled=daily at midnight, except on Sunday. This runs all "hourly" and "daily" tasks. Run --scheduled=weekly at midnight Sunday, except on the first day of the month. This runs all "hourly", "daily", and "weekly" tasks. Run --scheduled=monthly at midnight on the first day of the month. This runs all scheduled tasks. There is some subtlety between whether the "weekly" runs should be a subset of "monthly" and maybe the easiest way to handle that would be to not support "monthly" and have only "hourly", "daily", and "weekly" options for now. This should get around all of the parallel issues and allow us to drop the *.lastRun config option. Thoughts? Thanks, -Stolee