Jenkins cron syntax
A Jenkins schedule has five fields, like crontab. Each line in the schedule box is a separate schedule:
| Field | Allowed values | Special characters |
|---|---|---|
| Minute | 0–59 | , - * / H |
| Hour | 0–23 | , - * / H |
| Day of month | 1–31 | , - * / H |
| Month | 1–12 | , - * / H |
| Day of week | 0–7 (0 and 7 = Sunday) | , - * / H |
Special characters
| Symbol | Meaning |
|---|---|
H | A value derived from the job’s name. H in the minute field is one fixed minute per job, so H * * * * runs hourly at, say, :37 — always the same minute for that job. |
H/n | Every n units at a job-specific offset: H/15 * * * * might run at :07, :22, :37 and :52. |
H(a-b) | A job-specific value within a range: H H(0-7) * * * runs once a day at some time before 08:00. |
@ | The aliases @hourly, @daily, @weekly, @monthly and @yearly use H; @midnight means some time between 00:00 and 02:59. |
# | Lines that start with # are comments, and a line such as TZ=Europe/London sets the time zone of the schedule. |
Jenkins cron examples
Click an expression to load it into the generator above.
| Expression | Schedule |
|---|---|
| At a fixed minute chosen by Jenkins. | |
| Every 15 minutes, at an offset chosen by Jenkins. | |
| Every 10 minutes between minutes 0 and 29, at an offset chosen by Jenkins. | |
| At a time of day chosen by Jenkins. | |
| At a fixed minute chosen by Jenkins, between 2:00 AM and 2:59 AM, Monday through Friday. | |
| At a fixed minute chosen by Jenkins, every 2 hours, between 9:00 AM and 4:59 PM, Monday through Friday. | |
| At a time of day chosen by Jenkins, on days 1 and 15 of the month, from January through November. | |
| At a fixed minute chosen by Jenkins, during one hour between 12:00 AM and 2:59 AM chosen by Jenkins. |
How Jenkins cron differs from Unix cron
- Use
Hinstead of fixed minutes.0 2 * * *makes every nightly job start at exactly 02:00, whileH 2 * * *spreads them over the hour — Jenkins even suggests this when you save a fixed time. - There is no seconds field, and Quartz characters such as
?,LandWare not supported. - Short day-of-month steps such as
*/3orH/3run unevenly near the end of the month, because the count restarts on the 1st. - Schedules use the time zone of the Jenkins controller unless you add a
TZ=line.
Use it in a Jenkinsfile
In a declarative pipeline, put the schedule in the triggers block:
pipeline {
agent any
triggers {
cron('H 2 * * 1-5')
}
stages {
stage('Nightly build') {
steps { sh './build.sh' }
}
}
}
Polling the repository works the same way with pollSCM('H/5 * * * *'), but a webhook from your Git server is usually better than frequent polling.
Frequently asked questions
What does H mean in a Jenkins cron schedule?
H stands for “hash”. Jenkins replaces it with a number calculated from the job name, so each job gets a different but stable value. H * * * * still runs once an hour, but every job picks its own minute, which spreads the load on the controller and agents.
Why does Jenkins tell me to use H instead of 0?
When you save 0 2 * * *, Jenkins suggests H 2 * * *, because many jobs scheduled at exactly the same minute start together and compete for executors. With H, the job still runs during the 02:00 hour, just at a minute of its own.
How do I set the time zone of a Jenkins schedule?
Add a line such as TZ=Asia/Riyadh above the schedule. In a Jenkinsfile, put the TZ= line and the schedule on separate lines inside the cron string. Without it, the schedule follows the time zone of the Jenkins controller.
Cron generators for other platforms
*/15 8-18 * * 1-5
Quartz Cron Expression Generator
0 0 8 ? * MON-FRI
Spring Cron Expression Generator
0 0 8 * * MON-FRI
AWS Cron Expression Generator
0 8 ? * MON-FRI *
Salesforce Cron Expression Generator
0 0 8 ? * MON-FRI
Hangfire Cron Expression Generator
0 8 * * 1-5
Airflow Cron Expression Generator
0 6 * * 1-5
node-cron Expression Generator
0 30 8 * * 1-5