Skip to content
Cron Cookbook

Jenkins cron syntax, with examples

Jenkins schedules jobs with a crontab-style expression in the Build periodically and Poll SCM triggers. It uses the same five fields as Unix cron (minute, hour, day of month, month, day of week) but adds the H hash symbol, a TZ= line for time zones, and one rule that differs from standard cron. To run a job once a day, use H H * * *.

Five things that differ from Unix cron

  1. H spreads jobs across the clock

    In place of a fixed value, H picks one from a hash of the job's name, so jobs on the same schedule don't all start at once.
  2. Aliases are hashed too

    @daily is once a day at a time picked per job, not midnight, and @midnight is some time between 12:00 and 2:59 AM.
  3. Both day fields have to match

    Standard cron runs when either day field matches. Jenkins needs both, so H 9 1-7 * 1 means the first Monday of the month.
  4. TZ= sets the time zone

    Schedules follow the controller's time zone unless the first line names another, like TZ=Europe/London.
  5. A changed schedule waits for one run

    A pipeline registers its triggers when it runs, so a new or changed cron takes effect after the next build.

The H symbol

H stands for “hash”. In place of a fixed value, Jenkins picks one from a hash of the job's name, so each job gets its own stable offset. A dozen jobs set to 0 0 * * * all start at midnight and spike the controller; the same jobs set to H H * * * still run once a day each, but spread across the day. The value is not random: a given job runs at the same time every day.

H works with ranges and steps. H(0-7) in the hour field picks an hour from 0 to 7, and H/15 in the minute field runs every 15 minutes starting from a per-job offset. When you save a schedule such as */15 * * * * or 0 2 * * *, Jenkins shows a warning suggesting the H form instead. The plain form still works; the warning is only about load.

Jenkins cron examples

ExpressionRuns
H/15 * * * *Every 15 minutes, at a fixed offset per job (perhaps :07, :22, :37, :52)
H * * * *Once an hour, at a minute chosen per job
H H * * *Once a day, at a time chosen per job
H 2 * * *Once a day during the 2 AM hour
H H(0-7) * * *Once a day, some time between midnight and 7:59 AM
H(0-29)/10 * * * *Every 10 minutes in the first half of each hour (three runs, perhaps :04, :14, :24)
H H(8-15)/2 * * 1-5Once in every two-hour slot between 8 AM and 4 PM, Monday to Friday
45 9-16/2 * * 1-5At 9:45, 11:45, 13:45 and 15:45, Monday to Friday
H H 1,15 1-11 *Once a day on the 1st and 15th of every month except December

Aliases: @daily, @midnight and the rest

Jenkins accepts these shortcuts, and every one of them is hashed. That surprises people coming from Unix cron, where @daily means exactly midnight: in Jenkins, @midnight means some time between 12:00 and 2:59 AM. Jenkins doesn't support @reboot.

AliasSame asRuns
@hourlyH * * * *Once an hour, at any minute
@dailyH H * * *Once a day, at any time
@midnightH H(0-2) * * *Once a day between 12:00 AM and 2:59 AM
@weeklyH H * * HOnce a week, on any day
@monthlyH H H * *Once a month, on a day from the 1st to the 28th
@yearly / @annuallyH H H H *Once a year

Day of month and day of week both have to match

In standard cron, when both day fields are restricted, the job runs when either matches. Jenkins requires both. H 9 1-7 * 1 runs only on the first Monday of each month in Jenkins, while crontab would run it on the 1st to the 7th and on every Monday. Day of week accepts 0 to 7, and both 0 and 7 mean Sunday.

Time zones with TZ=

Schedules run in the time zone of the Jenkins controller's JVM. To use another zone, put TZ= and a Java time zone ID on the first line. Lines starting with # are comments, and each further line is another schedule:

Build periodically › Schedule
TZ=Europe/London
# Every weekday morning, London time
H 8 * * 1-5
# And once more in the evening
H(0-30) 17 * * 1-5

Cron triggers in a Jenkinsfile

In a declarative pipeline, the same expressions go in a triggers block, as in the example Jenkinsfile. cron builds on schedule; pollSCM checks the repository on schedule and builds only when something changed.

Jenkins registers the trigger when the pipeline runs, so a new or changed schedule takes effect only after the job has run once with it.

Build periodically, Poll SCM and scripted pipelines

Every Jenkins trigger takes the same expression; only the place you type it changes. In a freestyle job, the Build periodically and Poll SCM boxes each take one or more schedule lines. In a pipeline, keep the schedule in the Jenkinsfile: a scripted pipeline's properties step replaces the job's properties when it runs, including any trigger set on the configuration page.

Job typeWhere the schedule goesDoes
Freestyle jobConfigure › Triggers › Build periodicallyBuilds on schedule
Freestyle jobConfigure › Triggers › Poll SCMChecks the repository on schedule, builds if it changed
Declarative pipelinetriggers { cron('H 2 * * *') }Builds on schedule
Declarative pipelinetriggers { pollSCM('H/15 * * * *') }Polls on schedule
Scripted pipelineproperties([pipelineTriggers([cron('H 2 * * *')])])Builds on schedule
With parametersparameterizedCron('H 2 * * * %ENV=staging')Needs the Parameterized Scheduler plugin

Multibranch pipelines run each branch's own Jenkinsfile, so a cron trigger schedules every branch that has it. To schedule one branch only, pass an empty string on the others:

Jenkinsfile
triggers {
    // Nightly build on main only; other branches get no schedule
    cron(env.BRANCH_NAME == 'main' ? 'H 2 * * *' : '')
}

Parameters. A scheduled build uses each parameter's default value. To pass other values on a schedule, install the Parameterized Scheduler plugin and use parameterizedCron: each line is a schedule, then %, then NAME=value pairs separated by ;. Here the job builds against staging once in the 2 AM hour on weekdays, and against production once in the 4 AM hour on Saturdays:

Jenkinsfile
parameters {
    string(name: 'ENV', defaultValue: 'dev')
}
triggers {
    parameterizedCron('''
H 2 * * 1-5 %ENV=staging
H 4 * * 6 %ENV=production
    ''')
}

Check a schedule: the messages under the box

When you type a schedule in Build periodically or Poll SCM, Jenkins checks it and prints a message under the box. For a pipeline, open Configure after the pipeline has run once: the trigger from the Jenkinsfile shows there with the same message. The first line is the quickest way to confirm when a job will next run, and in which time zone.

MessageWhen you see itWhat to do
Would last have run at …; would next run at ….The schedule is valid. Both times are in the schedule's time zone, which is printed with them.Read the zone in the message: if it says Coordinated Universal Time and you meant local time, add a TZ= line.
Spread load evenly by using ‘H 2 * * *’ rather than ‘0 2 * * *’The schedule has a fixed minute, starts with */, or lists minutes like 0,15,30,45, and has no H.Only a hint about load. Switch to the H form unless the job must start on the minute.
Do you really mean "every minute" when you say "* 2 * * *"? Perhaps you meant "H 2 * * *" to poll once per hourThe minute field is * while a later field is restricted, so the job runs every minute of each hour or day it matches.Put a minute (or H) in the first field.
Short cycles in the day-of-month field will behave oddly near the end of a monthThe day-of-month field matches 6 to 27 days, as */3, H/5 or 1-10 do.*/3 runs on the 31st and again on the 1st. If the gap matters, schedule by day of week instead.
This schedule will match dates only rarely (e.g. February 29) or never (e.g. June 31) …No run in the coming years, or only on leap days.Check the day and month fields, and remember Jenkins needs both day fields to match.
No schedules so will never runThe box holds only comments, a TZ= line or nothing.Add a schedule line, or clear the trigger.

Jenkins cron job not running?

If the message under the box shows the run you expect but no build starts with the cause Started by timer, it's usually one of these:

CauseFix
The pipeline hasn't run since you added the triggerA Jenkinsfile's triggers are registered when the pipeline runs. Build it once by hand.
A scripted pipeline's properties step removed itproperties([...]) replaces the job's properties, so a trigger set on the configuration page disappears after the next run unless the step lists pipelineTriggers too.
The time zone isn't the one you expectedSchedules follow the controller's JVM, often UTC in containers. The message under the box prints the zone; add a TZ= line.
The job is disabledA timer doesn't start a disabled job, and missed runs aren't made up when it's enabled again.
An earlier timer build was still waitingIf a timer build is still in the queue when the next one fires, Jenkins merges them into one queued build. A job that doesn't allow concurrent builds also waits for the running build to finish.
It's a multibranch branch without the scheduleEach branch reads its own Jenkinsfile. A branch that passes '' to cron, or has no trigger, gets no schedule.

Need the field-by-field basics first? See the cron expression syntax guide.