JenkinsCI/CDBuild Triggers9 min read

Jenkins Cron Schedule Guide

Jenkins extends standard cron with the H hash symbol to distribute load across the cluster. This guide covers every way to schedule Jenkins jobs — from simple periodic builds to pollSCM triggers — with real Jenkinsfile examples.

1. Jenkins Trigger Types

Jenkins has three main cron-based trigger types. They share the same 5-field syntax but serve different purposes:

TriggerPurposeWhen to Use
cronRun build on a schedule regardless of SCM changesNightly builds, scheduled reports, periodic cleanup
pollSCMPoll source control on a schedule, only build if changes foundProjects that can't use webhooks
upstreamTrigger after another job finishesPipeline chaining (not cron)

2. The H Hash Syntax

Jenkins extends cron with the H symbol. Instead of running all jobs at exactly the same minute (which spikes controller load), Jenkins hashes the job name to pick a consistent-but-staggered time within the allowed range.

H Syntax Examples
# BAD — all jobs fire at exactly midnight, controller overloaded
0 0 * * *

# GOOD — each job gets a random-but-stable minute in the midnight hour
H H * * *

# H in minute field = any minute (0–59), consistent per job
H * * * *

# H/15 = every 15 minutes (at H, H+15, H+30, H+45)
H/15 * * * *

# H(0-29) = any minute in the first half-hour
H(0-29) * * * *

# H H(6-7) * * 1-5 = weekday mornings between 6:00–7:59 AM
H H(6-7) * * 1-5
Tip: Always prefer H over literal numbers for Jenkins triggers. It spreads load automatically and the schedule stays stable across job renames.

3. cron Trigger (Periodic Builds)

The cron trigger fires a build on a fixed schedule, regardless of whether the source code has changed. Use it for nightly integration tests, report generation, or cleanup jobs.

Jenkinsfile (Declarative)
pipeline {
    agent any

    triggers {
        // Run nightly at some point during midnight hour
        cron('H H * * *')
    }

    stages {
        stage('Nightly Build') {
            steps {
                sh 'make test'
            }
        }
    }
}
Jenkinsfile (Scripted)
properties([
    pipelineTriggers([
        cron('H H * * *')
    ])
])

node {
    stage('Nightly Build') {
        sh 'make test'
    }
}

4. pollSCM Trigger

pollSCM checks the repository on a schedule and only triggers a build if changes are detected. Use this when you cannot configure webhooks on the remote SCM.

Performance note: pollSCM increases load on both Jenkins and your SCM server. Prefer webhooks (githubPush(), gitlabPush()) whenever possible. Use pollSCM only as a fallback for air-gapped or legacy environments.
Jenkinsfile — pollSCM every 5 minutes
pipeline {
    agent any

    triggers {
        // Poll SCM every 5 minutes; build only if changes found
        pollSCM('H/5 * * * *')
    }

    stages {
        stage('Build') {
            steps {
                checkout scm
                sh 'npm ci && npm test'
            }
        }
    }
}

5. Declarative Pipeline triggers{}

Declarative Pipelines define triggers in the top-level triggers block. You can combine multiple triggers in a single block.

Jenkinsfile — combined triggers
pipeline {
    agent any

    triggers {
        // Nightly full build (always)
        cron('H 2 * * *')
        // Also poll SCM every 15 min for quick feedback
        pollSCM('H/15 * * * *')
    }

    stages {
        stage('Test') { steps { sh 'make test' } }
        stage('Package') { steps { sh 'make package' } }
    }
}
Important: After adding or changing a triggers{} block, you must run the pipeline at least once manually for Jenkins to register the new schedule.

6. Scripted Pipeline (properties)

For Scripted Pipelines, use the properties() step at the top of your Groovy script to register triggers:

Jenkinsfile (Scripted)
// Register schedule — runs every Sunday at a hash-staggered time
properties([
    pipelineTriggers([
        cron('H H * * 0')
    ])
])

node {
    stage('Weekly Report') {
        checkout scm
        sh './scripts/generate-report.sh'
    }
}

7. Common Schedule Patterns

DescriptionExpressionNotes
Nightly build at midnight0 0 * * *Use H H * * * instead
Every 15 minutes (staggered)H/15 * * * *H distributes load
Every weekday at 8 AM (staggered)H 8 * * 1-5MON–FRI mornings
Once a week on Sunday nightH H * * 0Weekly deep build
First of every month at 2 AMH 2 1 * *Monthly release
Every hourH * * * *Hourly with stagger
Twice dailyH H(6-7) * * *Between 6–7 AM range
Every 5 minutes (poll)H/5 * * * *pollSCM pattern

8. Timezone Configuration

Jenkins cron runs in the system timezone of the Jenkins controller. By default this is often UTC, but it depends on how Jenkins was installed. Check with:

# In a Pipeline execute step to inspect the Jenkins timezone
sh 'date'
sh 'timedatectl'
# Or check in Jenkins: Manage Jenkins → System Information → user.timezone

To force a specific timezone for cron expressions, prefix the expression with a TZ= line:

Timezone-aware cron in Jenkinsfile
triggers {
    // Run at 9 AM New York time regardless of controller timezone
    cron('TZ=America/New_York\nH 9 * * 1-5')
}

9. Common Gotchas

Schedule not active until first manual run

After adding or modifying a triggers{} block, Jenkins won't register the schedule until the pipeline runs once. Always trigger a manual build after changing cron config.

Controller timezone is not always UTC

Don't assume UTC. A Jenkins controller installed on CentOS/RHEL may be set to a regional timezone. Always verify with `Manage Jenkins → System Information → user.timezone`.

cron vs pollSCM confusion

cron always builds. pollSCM only builds if SCM has new commits. For nightly integration test suites that must run regardless, use cron.

H is not available in standard Linux crontab

The H symbol is Jenkins-specific. Don't paste Jenkins cron expressions into /etc/crontab or cloud schedulers — they will fail. Use H only inside Jenkinsfile.

Jobs suspended on quiet Jenkins

If Jenkins is in quiet mode or the agent is offline at the scheduled time, the build is skipped entirely — there's no catch-up behavior by default. Consider setting startingDeadlineSeconds or using a monitoring alert.

Related Guides

Test your Jenkins cron expression

Paste any 5-field cron expression (without H) into our free tools to see the next run times and get a plain-English description.