I added a new job in Jenkins, which I want to schedule periodically.
From Configure job, I am checking the "Build Periodically" checkbox and in the Schedule text field added the expression:
15 13 * * *
But it does not run at the scheduled time.
Is it the correct procedure to schedule a job?
The job should run at 4:20 AM, but it is not running.
Add a Schedule to a Jenkins JobHead back to the job configuration and click the Build Triggers tab. Now, check the Build periodically box in the Build Triggers section. This will open the scheduling text area. Next, let's set the job to run every five minutes.
In the case of 3rd, 4th and 5th parameters asterisks '*' are used which means that no specific day , month and weekday is defined so it would trigger every day for whole month.
In the above example, we have used the cron expression “*/1 * * * *” which means to run the Jenkins job every minute.
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.
Jenkins used a cron expression, and the different fields are:
If you want to schedule your build every 5 minutes, this will do the job : */5 * * * *
If you want to schedule your build every day at 8h00, this will do the job : 0 8 * * *
For the past few versions (2014), Jenkins have 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, usingH 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.
More example of using 'H'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With