Issue
I have a job with as cron:
5 3,21 * * 1-5
This will run my job at 03:05AM and 09:05PM. Now I read it's a best practice to use H
.
H/5 3,21 * * 1-5
What is the meaning now? Will this schedule a build in a range of 5 minutes or 5 minutes after 3AM and 21PM?
Solution
The H
will take a numeric hash of the Job name and use this to ensure that different jobs with the same cron settings do not all trigger at the same time. This is a form of Scheduling Jitter
H/5
in the first field means Every five minutes starting at some time between 0 and 4 minutes past the hour
So H/5 3,21 * * 1-5
is Every five minutes between 03:00 and 03:59 and then between 21:00 and 21:59 on Mon -> Fri but starting at some 'random' time between 03:00 and 03:04 and then the same number of minutes after 21:00
If you want to run once per hour between 03:00-03:59 and 21:00-21:59 on Mon -> Fri, you can use H 3,21 * * 1-5
where H
will be replaced by some number between 0-59 depending on job name.
The user interface will tell you when the job will last have triggered and will next trigger
Answered By - Spangen Answer Checked By - Senaida (WPSolving Volunteer)