To
schedule a cron job every 5mins you need to define the cron settings like this:
*/5
* * * *
*/5
* * * * means every 5 minutes
5
* * * * means the 5th minute of every hour
|
Jenkins
lets you set up multiple times, separated by line breaks.
If
you need it to build daily at 7am, along with every Sunday at 4pm, the below
works well
H 7 * * *
H 16 * * 0
use */5 * * * * for
every 5mins
By setting the schedule
period to 15 13 * * * you tell jenkins to schedule the build every day of
every month of every year at the 15th minute of the 13th hour of the day.
What Jenkins used is a cron expression, the different fields are :
1. MINUTES Minutes in one
hour (0-59)
2. HOURS Hours in one day (0-23)
3. DAYMONTH Day in a month (1-31)
4. MONTH Month in a year (1-12)
5. DAYWEEK Day of the week
(0-7) where 0 and 7 are sunday
If you want to shedule
your build every 5 minutes, this will do the job : */5 * * * *
If you want to shedule
your build every day at 8h00, this will do the job : 0 8 * * *
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 :
The H symbol 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
|
No comments:
Post a Comment