Skip to content
Latchkey

How to Trigger a Jenkins Pipeline on a Cron Schedule

The triggers {} block schedules builds with cron for timed runs or pollSCM to poll source control on a timetable.

Add triggers { cron(...) } to a pipeline. Jenkins extends cron with an H (hash) symbol that spreads load by picking a stable minute per job.

Nightly cron trigger

The H in the minute field spreads builds across the hour to avoid thundering herds.

Jenkinsfile
pipeline {
  agent any
  triggers {
    cron('H 2 * * *')
  }
  stages {
    stage('Nightly') {
      steps {
        sh './nightly-checks.sh'
      }
    }
  }
}

Gotchas

  • Prefer H over a fixed minute (H 2 * * *) so Jenkins staggers jobs and avoids load spikes.
  • The trigger registers only after the pipeline runs at least once to parse the Jenkinsfile.
  • Use pollSCM('H/15 * * * *') to poll for changes; for push-based builds prefer SCM webhooks.

Key takeaways

  • triggers { cron(...) } schedules timed builds.
  • Use H to spread load across jobs and time.
  • The trigger activates only after one parsing run.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →