Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"H 5 * * 7" cron in Jenkins groovy script

I am trying to understand when this trigger runs in Jenkins groovy script. Seems to me that Jenkins groovy script has some DSL for cron. Does anyone know when this cron job is triggered?

triggers {
cron('H 5 * * 7')
}
like image 380
Ayman Patel Avatar asked Oct 18 '25 11:10

Ayman Patel


2 Answers

In H 5 * * 7 the H means hash. You can have digit in the first place, but H allows to distribute the load better.

H = minute when less load is expected, Jenkins will propose it the first time, after that it will stay more or less the same, if there are available agents to handle it.
5 = hour,
* = any value (every day),
* = any value (every month),
7 = 7th day of week (Sunday).

Reference: Spread load evenly by using ‘H * * * *’ rather than ‘5 * * * *’

like image 56
K. B. Avatar answered Oct 20 '25 11:10

K. B.


You can test it using the CRONTab tester. This means to start at 5:00 on every sunday

https://crontab.guru/#0_5_*_*_7
like image 43
Kaveesh Avatar answered Oct 20 '25 11:10

Kaveesh