How can I schedule a jenkins job every hour
The highest voted answer here is incorrect: Need to schedule a job every hour in jenkins
The right way to do this effectively is as follows:
-
If you already have/or plan to have multiple Jenkins jobs that you trigger periodically
a. If you want to schedule a job every hour but don't mind specifically on which minute it triggers then in order to produce an even load on Jenkins at all times use the automatic load balancing mechanism for scheduling the job (H) in the Jenkins cron expression which will cause the job to trigger pseudo randomly every hour:
-
@hourly
Alternatively: - H * * * *
- H */1 * * *
NB: Don't do this! (in Jenkins v2.89.3 or below)- H H/1 * * * (as it means schedule once a day at a pseudo random hour and minute rather than once every hour due to the idiosyncratic behaviour of Jenkins cron expressions where H/1 = H. If you think this is confusing, please upvote this issue - https://issues.jenkins-ci.org/browse/JENKINS-22129?jql=text%20~%20%22hourly%22)
b. If you want to schedule on a specific minute every hour (e.g. :30) then add a small range (e.g. +/- 5 mins) to minimise the load on the system:- H(30-35) * * * *
2. If you will only ever have a single Jenkins job that you wish to trigger periodicallyTo schedule on a specific minute (e.g. :30) then lock it down as follows:
- 30 * * * *
-
@hourly
Related videos on Youtube
Anthony
Updated on September 18, 2022Comments
-
Anthony over 1 year
I'm New to Jenkins. I have a job which i need to schedule every 1 hour.
I am using
* */1 * * *
but it is not working effectively.
Please provide any other solution.
-
fixer1234 over 6 yearsThis isn't just a duplicate, it's a plagiarized question.
-