Jenkins cron uses the same five fields as Unix cron, MINUTE HOUR DOM MONTH DOW, plus a symbol of its own: H, for hash, which spreads jobs out so they don't all start at the same moment. H H * * * runs a job once a day at a time Jenkins picks from the job's name.
In a declarative Jenkinsfile:
pipeline {
agent any
triggers {
cron('H */4 * * 1-5')
}
stages {
stage('Build') {
steps { sh 'make' }
}
}
}In a freestyle job, the same schedule goes in Build Triggers, Build periodically.
The fields
| Field | Values |
|---|---|
| MINUTE | 0 to 59 |
| HOUR | 0 to 23 |
| DOM (day of month) | 1 to 31 |
| MONTH | 1 to 12 |
| DOW (day of week) | 0 to 7, where 0 and 7 are both Sunday |
Each field accepts *, ranges (9-17), steps (*/15 or 0-30/10) and lists (1,15). Blank lines and lines starting with # are comments.
The H symbol
Fifty jobs all set to 0 0 * * * start together at midnight and fight for executors. H H * * * still runs each job once a day, but at a different, stable time per job. H works with ranges and steps:
| Expression | Meaning |
|---|---|
H * * * * | once an hour, at a minute fixed per job |
H/15 * * * * | every 15 minutes, at a per-job offset |
H(0-29)/10 * * * * | every 10 minutes during the first half of each hour |
H H(0-7) * * * | once a day, sometime between 00:00 and 07:59 |
H H(8-15)/2 * * 1-5 | every two hours during the working day, on weekdays |
H H 1,15 * * | on the 1st and 15th of each month |
45 9-16/2 * * 1-5 | at :45, every two hours from 9:45 to 15:45, on weekdays |
Aliases
Jenkins accepts @yearly, @annually, @monthly, @weekly, @daily, @midnight and @hourly. Unlike in Linux cron, they use H: @hourly means H * * * *, and @midnight means some time between 12:00 AM and 2:59 AM.
Time zones
Schedules follow the controller JVM's time zone. Override it for one job with a first line:
TZ=Europe/London H 8 * * 1-5
Common mistakes
- *` * * * ` when you meant hourly.* Jenkins warns about this and suggests
H * * * *. - Short day-of-month steps. Month lengths vary, so
*/3orH/3in the day field leaves an uneven gap at the end of most months. Jenkins picks hashed days from 1 to 28. - Polling when a webhook exists.
pollSCMchecks the repository for changes on a schedule; with GitHub or Bitbucket webhooks it is usually unnecessary. - *Every job at `0 0 * `.* Use
Hunless the exact time matters.
Running an AI agent from Jenkins
A Jenkins job can run an agent headless on any of these schedules, for example claude -p in a shell step; the scheduled skills page has skills ready to schedule. For the same idea on GitHub, see GitHub Actions cron.
Questions
What does H mean in Jenkins cron?
H stands for hash. Jenkins replaces it with a value derived from a hash of the job name, so each job gets its own stable minute or hour and jobs don't all start at once. It is not random: the same job always gets the same value.
What time does @daily run in Jenkins?
Once a day at a time hashed from the job name, because Jenkins aliases use H. @midnight is narrower: some time between 12:00 AM and 2:59 AM.
What time zone does a Jenkins cron use?
The time zone of the Jenkins controller's JVM. To use another one, put a line such as TZ=America/New_York before the schedule lines.
Where do I set a cron schedule in Jenkins?
In a Pipeline, with triggers { cron('...') } inside the pipeline block of the Jenkinsfile. In a freestyle job, tick Build periodically under Build Triggers and type the schedule.