Jenkins uses a cron expression, the different fields are :
- MINUTES Minutes in one hour (0-59)
- HOURS Hours in one day (0-23)
- DAYMONTH Day in a month (1-31)
- MONTH Month in a year (1-12)
- DAYWEEK Day of the week (0-7) where 0 and 7 are sunday
Since a few versions, Jenkins add a new parameter,
H : (extract from the jenkins code documentation)
To allow periodically scheduled tasks to produce even load on the system, the symbol
H(for “hash”) should be used wherever possible.
For example, using
0 0 * * *for a dozen daily jobs will cause a large spike at midnight. In contrast, using
H H * * *would still execute each job once a day, but not all at the same time, better using limited resources.
Note also that :
Hsymbol can be thought of as a random value over a range, but it actually is a hash of the job name, not a random function, so that the value remains stable for any given project.
Example 1 : H H(3-4) * * * : A job which runs every Day of the week, every Month in a year , every Day in a month at a time between 3 – 4 am in the morning at any minute.
Example 2 : H (30 -45) 3 * * * : A job which runs every Day of the week, every Month in a year , every Day in a month at 3 am in the morning between 30 -45 minutes.
Example 3 : */5 * * * * : If you want to shedule your build every 5 minutes, this will do the job
Example 4 :
0 8 * * * : schedule your build every day at 8h 00, this will do the job
Have fun as you work!
See Also: Parameterised Scheduler Plugin