KeepSmiling
KeepSmiling

Reputation: 13

Jenkins CRON Expression not triggering at right time

how to add JENKINS CRON Expression for every Sunday 2 am .

I used expression like

     H  2  *  *  0 

but it is triggering @ 2:30am instead of 2am

Upvotes: 0

Views: 2082

Answers (2)

Mor Lajb
Mor Lajb

Reputation: 2636

this is the correct format 0 2 * * 0 ( the first 0 digit is the minute)

you can read some more at http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

Thanks

Upvotes: 0

Christopher Orr
Christopher Orr

Reputation: 111555

If you want a job to build every Sunday at 2:00 AM exactly, you should use this syntax:

0 2 * * 0

i.e. at minute 0, of hour 2.

But in general when scheduling tasks with Jenkins, it's a good idea to use the H parameter in order to ensure that lots of jobs don't all start at exactly the same time, like on the hour. Using H spreads out the load between jobs, to avoid overwhelming the server.

As you've seen, using H 2 * * 0 may start at any time between 2 and 3 AM. Though for one job, the execution time will remain the same, e.g. always 2:30. Jenkins tells you below the cron textbox when it will execute next.

Upvotes: 1

Related Questions