What Is a Scheduled Build (Cron) in Jenkins?

What Is a Scheduled Build (Cron) in Jenkins?

A plain-English guide to making Jenkins start work by the clock: how the schedule text is read, why the letter H matters, how time zones and missed runs behave, and how to keep scheduled builds safe, useful and quiet.

Every morning, your phone alarm rings at the same time. You did not have to remember anything. You told the phone once, and it has been reliable ever since. Now imagine that your software project also had an alarm clock: every night at two o’clock, while everyone is asleep, a full set of tests runs, a fresh package is created, and a report is waiting in the team’s inbox by breakfast. That alarm clock exists in Jenkins, and it is called a scheduled build.

Scheduled builds are one of the first features that teams turn on after they learn Jenkins, and also one of the easiest to misuse. A badly written schedule can start fifty builds at the same second, run a heavy job in the middle of the working day, or silently never run at all. In this guide you will learn what a scheduled build is, how the schedule text works, why Jenkins adds a special letter to the old cron rules, and how to build schedules you can trust. Every new word is explained when it first appears, so you can read from top to bottom without stopping.

WWhat Is a Scheduled Build?

A scheduled build is a Jenkins build that starts because the clock says so, not because a person clicked a button or a developer saved new code.

Start with the basics. Jenkins is an automation server, a program that stays switched on and does tasks for you. A job is the saved description of a task, and a build is one single run of that job. Every build begins because of a trigger, an event that says “start now.” Common triggers are a person clicking a button, a code change arriving, or another job finishing.

A scheduled build uses the clock as its trigger. You give the job a schedule, and Jenkins starts a build whenever the time matches. In the Jenkins screens, the option is often named Build periodically. The schedule itself is written in a small text format borrowed from a very old Unix tool called cron, which is why people say “a cron build” or “a Jenkins cron job.” The word cron comes from the Greek word for time.

Everyday Analogy

Think of a school bell. Nobody presses a button when the first lesson ends. The bell system has a timetable, and it rings on schedule every day, whether or not anything special happened. A scheduled build is that bell. It rings at the times in the timetable, and the “lesson” it starts is your job.

It is important to see what a scheduled build is not. It does not watch your code. It does not care whether anything has changed. When the time comes, the build starts, even if nothing is new since yesterday. That is exactly what you want for some tasks, such as a nightly backup, and exactly wrong for others, such as “check whether the developers pushed anything.” We will compare the two ideas carefully later in this guide.

i
Tip

A useful test: ask “Should this run even if nothing changed?” If yes, a schedule fits. If no, you probably want a trigger that reacts to changes, such as a webhook.

5 fields
in a Jenkins schedule line
1 minute
smallest time step
H
Jenkins’ own spreading letter

What teams commonly schedule

Quality

Nightly full test run

A long test suite that is too slow to run on every code change, so it runs once each night on the latest code.

Release

Nightly packages

Create a fresh installable version each night so testers always have something recent to try.

Safety

Backups

Save databases, files or the Jenkins home folder at fixed times.

Security

Weekly scans

Check libraries and container images for newly announced weaknesses, even when your own code did not change.

Cleanup

Housekeeping

Remove old files, stop unused cloud machines, or empty temporary folders.

Reports

Summaries

Send a weekly report of build health, test trends or costs to the team.

HA Short History: Where Cron Comes From

The schedule format in Jenkins is decades older than Jenkins itself. Knowing where it came from explains its odd look.

Long before web pages and cloud servers, computers running Unix needed a way to do chores at fixed times, such as rotating log files or sending nightly mail. The answer was a small background program called cron. It read a table, checked the clock every minute, and ran whatever was due. The table was called a crontab, short for “cron table.” Each line held a time pattern and a command, and the time pattern used five fields separated by spaces.

That five-field pattern was so simple and so flexible that it became a standard. Nearly every scheduling tool since has either copied it or offered it as an option. When Jenkins, then called Hudson, needed a way to start builds at chosen times, it made sense to reuse this well-known pattern. Anyone who had set up a cron table on a server could set up a scheduled build with no new learning.

Everyday Analogy

Think of a piano keyboard. The keys were designed long ago, and every new instrument that copied the layout gained millions of players who already knew how to use it. Cron’s five-field pattern is like that keyboard layout. It is not the prettiest design imaginable, but everyone recognizes it.

1

1970s: cron appears on Unix

System administrators get a background program that runs chores on a timetable, checking once every minute.

2

1980s and 1990s: the five-field pattern spreads

Many Unix and Linux systems adopt the same format, with small additions such as ranges, lists and step values.

3

2000s: build servers borrow it

Hudson, and then Jenkins, reuse the cron format so that teams can start builds by the clock.

4

Jenkins adds the letter H

Because thousands of teams all wrote “midnight,” Jenkins servers were slammed at exactly the same moment. The H symbol was added to spread that load out.

!
Do not assume it is identical

Jenkins schedules look like ordinary cron, but they are read by Jenkins, not by the operating system’s cron program. Some details, such as the H symbol and the way time zones are chosen, are special to Jenkins. Always trust the Jenkins preview message over memory of how a server’s cron behaves.

CCore Concepts You Need to Know

A few small ideas explain almost everything about scheduled builds. Learn them once and the rest of the guide becomes easy.

Start

Trigger

The event that starts a build. A schedule is one kind of trigger, based on time alone.

Text

Cron expression

The short line of text, five fields long, that describes when the build should start.

Option

Build periodically

The Jenkins setting where you type a schedule so that builds start by the clock, regardless of changes.

Option

Poll SCM

A different setting that also uses schedule text, but only starts a build if the code repository has changed.

Letter

H (hash)

A Jenkins-only symbol that means “pick a stable value for this job,” used to spread jobs across time.

Line

Build queue

The waiting line where a scheduled build stands until an agent has a free executor.

Clock

Time zone

The region whose clock the schedule follows. By default it is the clock of the Jenkins server.

Cause

Timer cause

The note stored on each build that says it was “Started by timer,” so you can tell scheduled runs from manual ones.

Job, build and agent, quickly

A job is the recipe, and each run of it is a build. The main Jenkins server, called the controller, keeps the schedule and starts the request. The build itself runs on an agent, a separate machine or container, in a slot called an executor. When the clock matches your schedule, the controller places a build request in the queue, and from that point the build behaves like any other build.

Everyday Analogy

A restaurant again. The head waiter (controller) has a note on the wall: “At 2 a.m. every night, cook the big batch of soup.” When the clock strikes two, the head waiter writes an order and puts it on the counter (queue). The next free cook (executor) at a kitchen station (agent) takes it. The note only decides when the order is written. It has no say in who cooks it or how.

i
Tip

Scheduling only controls when a build is requested. Whether it starts right away depends on the queue and on free executors. A schedule for 2 a.m. does not promise a start at exactly 2:00 if every executor is busy.

AArchitecture: How Jenkins Keeps Time

Somewhere inside the controller is a small clock watcher. Seeing its place in the system explains many surprises.

flowchart LR
    Admin["Job owner"] -->|"saves schedule"| Cfg["Job Configuration"]
    Cfg --> Home["Stored in JENKINS_HOME"]
    Clock["Controller Clock Ticker"] -->|"every minute"| Sched["Schedule Checker"]
    Home --> Sched
    Sched -->|"time matches"| Queue["Build Queue"]
    Queue -->|"free executor"| Agent["Agent"]
    Agent -->|"log and result"| Ctrl["Jenkins Controller"]
    Ctrl --> Notify["Email and Chat"]
Figure 1: How a schedule becomes a running build.

Reading the diagram

Begin at the left. The job owner types a schedule into the job’s settings, and Jenkins saves it in the job configuration inside its home folder. On the controller, a clock ticker wakes up once every minute. Each time it wakes, a schedule checker looks through the saved schedules and asks, “Does the current minute match this one?” For every match, the controller places a build request in the build queue. When an agent has a free executor, the build moves there, runs, and reports its log and result back to the controller, which can then send a message to email or chat.

Three facts that follow from this design

  • The controller must be running. The clock ticker lives inside the controller. If Jenkins is switched off at the scheduled minute, nothing starts.
  • Precision is one minute. The checker wakes once a minute, so you cannot schedule seconds, and a build may begin a little after the minute rather than on the dot.
  • The controller’s clock decides. Unless you say otherwise, “2 a.m.” means 2 a.m. on the controller’s own clock and time zone, not yours.
!
Missed schedules are not replayed

If the controller is down or restarting when a scheduled minute passes, Jenkins does not go back and run the missed build later. It simply waits for the next matching time. If a task is critical, add monitoring that tells you when an expected build did not happen.

RReading a Jenkins Schedule: The Five Fields

A schedule is one line of text with five pieces. Once you know what each piece means, reading any schedule becomes easy.

A Jenkins schedule has five fields, separated by spaces, always in the same order. Each field answers one small question about time.

PositionFieldAllowed valuesQuestion it answers
1Minute0 to 59Which minute of the hour?
2Hour0 to 23Which hour of the day, using a 24-hour clock?
3Day of month1 to 31Which day of the calendar month?
4Month1 to 12Which month of the year?
5Day of week0 to 7Which weekday? Both 0 and 7 mean Sunday, and 1 means Monday.
Everyday Analogy

Read a schedule like the details on a party invitation: “At this minute, in this hour, on this day of the month, in this month, on this weekday.” A star in any position means “any value is fine,” like an invitation that says “any day works.”

The special characters

SymbolMeaningPlain example of the idea
Star (*)Every possible value of that fieldA star in the hour field means “every hour”
Comma (,)A list of separate values“9,13,17” in the hour field means nine, one and five o’clock
Dash (-)A range of values“1-5” in the weekday field means Monday through Friday
Slash (/)A step: every so many values“/15” in the minute field means every fifteen minutes
HA stable, job-specific value chosen by Jenkins“H” in the minute field means some fixed minute, different for each job

Reading some real schedules

The table below shows common schedules and how to read them aloud. Practice saying each one in words. It is the best way to make the format feel natural.

ScheduleHow to read it
H * * * *Once every hour, at a minute chosen by Jenkins for this job
H 2 * * *Once a day, sometime during the 2 a.m. hour
H 2 * * 1-5Once a day during the 2 a.m. hour, Monday through Friday
H/15 * * * *Every fifteen minutes, with the starting point chosen by Jenkins
H H(0-5) * * *Once a day, at a hash-chosen time between midnight and 5 a.m.
H 9-17/2 * * 1-5Every two hours between nine and five on weekdays
H 3 * * 0Once a week, on Sunday, during the 3 a.m. hour
H 4 1 * *Once a month, on the first day, during the 4 a.m. hour

Shortcut names

Jenkins also understands a few friendly words that stand for common schedules. These start with the at sign. They are handy for simple cases and they also use the hash idea behind the scenes, so the exact minute or hour is chosen for you.

  • @hourly means once every hour.
  • @daily and @midnight mean once a day, around midnight.
  • @weekly means once a week.
  • @monthly means once a month.
  • @annually and @yearly mean once a year.
i
Tip

You do not need to guess whether a schedule is right. When you type it in the job settings, Jenkins shows a message under the box such as “Would last have run at …” and “Would next run at …”. Check those two lines every single time. They are your instant proof of what the schedule really means.

HThe Letter H: Jenkins’ Gift to Busy Servers

The hash symbol looks like a tiny detail, but it is the difference between a calm Jenkins and one that struggles every midnight.

Picture a large company with two hundred jobs. Nearly every team wants a nightly build, and nearly everyone thinks “midnight” is the natural choice. If all two hundred jobs are set to start at exactly midnight, then at one minute past eleven fifty-nine there is silence, and at midnight two hundred build requests arrive at the same instant. Agents run out of free executors, the queue grows long, the controller strains, and every job slows down. Then, minutes later, the system goes quiet again.

Everyday Analogy

Think of a cinema where every show starts at exactly eight o’clock. Everyone crowds the ticket desk at 7:55, and the staff are overwhelmed. If the cinema staggers start times, with shows at 7:40, 7:55, 8:10 and 8:25, the crowd is spread over the evening and everyone is served smoothly. The H symbol staggers your job start times automatically.

What H really does

When you write H in a field, Jenkins picks a value for that field by using the name of the job as a seed. It does the same calculation every time, so the chosen value is stable: the same job always gets the same minute. But different jobs get different values, so they spread across the available range. That gives you the best of both worlds. Each job runs at a predictable time, but the whole set of jobs is scattered.

flowchart LR
    subgraph Before["Everyone chooses midnight"]
        J1["Job A"] --> M["00:00 crowd"]
        J2["Job B"] --> M
        J3["Job C"] --> M
        J4["Job D"] --> M
    end
    subgraph After["Everyone uses H"]
        K1["Job A at 00:07"]
        K2["Job B at 00:23"]
        K3["Job C at 00:41"]
        K4["Job D at 00:52"]
    end
Figure 2: A crowd at one moment versus load spread across the hour.

Reading the diagram

The left side shows four jobs that all name the same moment. They pile up together at midnight and compete for the same executors. The right side shows the same four jobs using H. Each job lands on its own minute within the hour, so the controller and agents see a steady trickle instead of a wave.

Using H with ranges and steps

You can limit the range that H chooses from. Writing H followed by a range in brackets tells Jenkins to pick within that range only. For example, an hour field with H and the range zero to five means “choose an hour between midnight and five in the morning.” A minute field with H and a step of fifteen means “every fifteen minutes, but shifted by a job-specific offset,” so different jobs do not all fire on the quarter hour. This is the healthy replacement for the old habit of writing a star with a slash.

!
Warning

Jenkins shows a gentle warning when a minute field is a fixed number like zero and suggests using H instead. Do not ignore it on a shared server. If the schedule really must run at an exact minute, for example to match a business process, then use the exact minute on purpose and accept the cost.

When exact times are correct

Use an exact time when another system depends on it. For instance, a finance team may need a report ready at precisely six in the morning. Here H would be wrong, because the moment matters more than load spreading. To stay safe, schedule the build early enough to finish well before the deadline, and use only a few such exact schedules.

TTime Zones and Daylight Saving

“Two in the morning” is not one moment for the whole planet. Jenkins needs to know whose two in the morning you mean.

By default, Jenkins reads a schedule using the time zone of the controller, the clock of the machine where Jenkins runs. If your controller is set to universal time and your team lives in another region, then “2 a.m.” might arrive in the middle of your workday. Many cloud servers default to universal time, so this surprise is very common.

Everyday Analogy

Imagine a friend who says, “Call me at nine.” Nine where? If you live in different cities, that sentence means two different moments. A scheduled build has the same problem, and the schedule needs a clear answer to the question “whose nine?”

Three ways to be clear

  • Check the preview message. The “would next run at” line shows a real date and time, and a time zone label, so you can compare it with your own clock.
  • Set the time zone inside the schedule. Jenkins lets you put a time zone line at the very top of the schedule box, naming a region such as a continent and city. All lines below it are then read in that region’s local time.
  • Set the controller’s own time zone. This changes the meaning of every schedule on the server, so it is a bigger decision and should be made deliberately.

Daylight saving time

Some regions move their clocks forward in spring and back in autumn. That creates two awkward nights each year. When clocks jump forward, one hour simply does not exist, so a job scheduled inside that hour may be skipped or run at a different moment than you expect. When clocks fall back, one hour happens twice, so a job scheduled in that hour might run twice. Jobs that must run exactly once per day should avoid the hour that changes, which is often around two or three in the morning in affected regions. Choosing a time such as five in the morning, or working in universal time, sidesteps the problem.

SituationRiskSafer choice
Team in one region, server in anotherBuilds run at surprising local timesSet the time zone inside the schedule
Team across many regionsNo single “night” existsPick universal time and document it
Region with daylight savingSkipped or doubled runs near the changeAvoid the hour where clocks change
Cloud migration of the controllerServer time zone changes and every schedule shiftsRecheck previews for important jobs after moving
i
Tip

Write the intended time zone in the job description. A future teammate reading “2 a.m.” should not have to guess whether it means your office or the server room.

LThe Life of a Scheduled Build, Step by Step

From the moment the clock matches to the moment a record is saved, every scheduled build follows the same road.

Everyday Analogy

Think of a newspaper printing schedule. At a fixed hour, the presses start. Paper is loaded, pages are printed, the copies are counted, and the trucks are loaded. Even if the news is quiet that day, the paper is still printed. The steps of a scheduled build are the same each time, whatever the content.

flowchart TD
    A["Clock ticks: a minute passes"] --> B["Schedule matches this minute"]
    B --> C["Build request added to queue"]
    C --> D["Executor becomes free"]
    D --> E["Agent prepares workspace"]
    E --> F["Code is checked out"]
    F --> G["Stages and steps run"]
    G --> H["Result decided"]
    H --> I["Reports and notifications"]
    I --> J["Record kept: Started by timer"]
Figure 3: The life of one scheduled build.
1

The minute matches

The controller’s clock watcher finds that the current minute fits the job’s schedule.

2

The request is queued

A build request joins the queue with the reason “Started by timer.” If the same job is already waiting, Jenkins normally merges the requests instead of stacking copies.

3

An executor is found

The scheduler matches the request to an agent with the right label and a free slot. If none is free, the build keeps waiting.

4

Code is fetched

The agent prepares a workspace and downloads the latest code, which may be the same as yesterday’s if nothing changed.

5

The work runs

Stages and steps run in order. A failing step normally stops the build, which is called failing fast.

6

Result and cleanup

The result is decided, reports are published, messages are sent, and the workspace is cleaned.

7

History is saved

The record joins the job history. Old records may later be deleted by retention rules.

What if the last build is still running?

Sometimes a scheduled build takes longer than the gap between schedules. Suppose a job runs every hour, but one run takes ninety minutes. When the next hour arrives, the previous build is still working. What happens depends on whether the job allows concurrent builds. If concurrency is off, the new request waits in the queue until the earlier build finishes. If it is on, a second build may start alongside the first. Neither is automatically right. A job that writes to one shared place should usually forbid concurrency, or two runs may trample each other. But a job that only reads and reports may run side by side without trouble.

!
The pile-up problem

If runs keep getting slower than the schedule gap, the queue grows a little more each cycle, and eventually builds are waiting for hours. Watch build duration. If a run takes longer than its interval, either lengthen the interval, speed up the job, or add capacity.

BBuild Periodically versus Poll SCM

Two Jenkins options both use cron-style text. They sound similar, but they do very different things.

Beginners often mix these two options, so this chapter is worth reading slowly. Both use the same five-field schedule text. The difference is what happens when the time arrives.

QuestionBuild periodicallyPoll SCM
What happens at the scheduled time?A build starts, alwaysJenkins asks the code repository whether anything changed
When is a build created?Every time the schedule matchesOnly if there are new changes since the last check
Does it care about code changes?NoYes, that is its whole purpose
Best forNightly tests, backups, reports, cleanupsEnvironments that cannot receive webhooks
Main costRuns even when nothing is new, using resourcesConstant questions to the code host, plus delay before builds start
Everyday Analogy

Build periodically is a lawn sprinkler on a timer: it waters every morning, rain or shine. Poll SCM is a gardener who walks out every ten minutes, feels the soil, and turns on the water only if it is dry. And a webhook is a soil sensor that sends a message to the gardener’s phone the moment the soil dries out. The sensor is the best of the three, because nobody wastes effort and nobody waits.

Why webhooks usually beat polling

A webhook is a message that your code host sends to Jenkins the instant something changes. It is fast, it wastes nothing, and it scales well. Polling makes Jenkins ask again and again, “Anything new?” With a hundred jobs each polling every minute, that is a hundred questions a minute, mostly answered “no.” Use polling only when the network makes webhooks impossible, and if you must, poll less often and use H to spread the questions out.

Combining the ideas

Many teams use several triggers on one project. A webhook builds each change within seconds for quick feedback. A nightly schedule then runs a longer, deeper set of tests on the latest code. A weekly schedule scans for newly announced weaknesses in libraries. Each trigger has a clear purpose, and none of them fights the others.

i
Tip

For multibranch pipelines, Jenkins has a related option that periodically scans the repository for new branches and pull requests. Use it as a safety net behind webhooks, not as the main way of detecting changes.

WWhere You Set a Schedule: Web Forms and Pipelines

You can set a schedule through a web form or inside the pipeline recipe. Both create the same kind of trigger.

In a classic job

In a freestyle job, open the job’s configuration page and find the section for build triggers. Tick the box called Build periodically, and a text box appears. Type the schedule there. Under the box, Jenkins shows the “would last have run” and “would next run” lines. Save the job and the schedule is active.

In a pipeline job

In a pipeline, the schedule can live inside the pipeline recipe itself, in the section that lists triggers. This is the better place for serious projects, because the schedule is then stored beside the code, reviewed by teammates, and versioned in history. If the server is lost and rebuilt, the schedule comes back automatically when the pipeline runs again. One thing to remember is that a trigger defined inside a pipeline file is registered when the pipeline runs. So after adding or changing it, the job may need to run once before the new schedule takes effect.

Everyday Analogy

A schedule set on a web form is like a note taped to the office fridge. It works, but if the fridge is replaced, the note is gone. A schedule written into the pipeline file is like a rule written in the company handbook. It follows the project wherever it goes and everybody can see who changed it and when.

In multibranch pipelines

Each branch has its own pipeline, and a schedule inside the file applies to each branch that has it. This can surprise teams, because a nightly trigger might then run for every active branch, multiplying the load. Many teams limit scheduled work to the main branch by adding a condition, so feature branches are only built when their code changes.

Passing options to scheduled builds

A scheduled build normally runs with the default values of any parameters, since no person is there to choose. If you need different options at different times, such as a fast test set every hour and a deep test set every night, there is a plugin that lets you attach parameter values to each schedule line. Another approach is to create two jobs that share the same pipeline recipe but have different defaults.

i
Tip

Whenever possible, keep schedules in the pipeline file, not in the web form. It makes the schedule reviewable, repeatable and recoverable.

PChoosing a Good Schedule

Picking a schedule is a design decision. A few questions make the answer clear.

1

What is the purpose?

Is the goal fast feedback, a daily health check, a backup, a report, or a cleanup? The purpose decides how often and when.

2

How long does it take?

The gap between runs must be longer than the run itself, with room to spare, or builds will pile up.

3

Who needs the result, and when?

If the team reads a report at nine, finish before nine, and allow for slow nights.

4

What else runs at that time?

Avoid piling heavy jobs into the same window. Spread them out with H and different hour ranges.

5

What does it cost?

Every scheduled build uses machines, sometimes paid cloud machines. Frequent runs of expensive jobs add up over months.

6

What happens if a run is missed?

Missed runs are not replayed. Decide whether that is acceptable, and add monitoring if it is not.

Common schedule choices and their reasons

PurposeTypical rhythmWhy
Full test suite that is slowOnce a nightUses idle machines and gives fresh results every morning
Quick health checkEvery hour or two in working hoursCatches problems while people are around to fix them
Security scan of librariesOnce a day or weekNew weaknesses are announced over time, even when your code is unchanged
BackupsNightly, off-peakLow load and a steady recovery point
Weekly summary reportMonday early morningReady when the week begins
Cleanup of old files or cloud machinesNightly or weeklyKeeps cost and disk usage down
Long performance testWeekendNeeds a quiet system and many hours

A worked example: planning schedules for one small team

Imagine a team of eight people building a web shop. They want quick feedback while they work, a deep check every night, and a few housekeeping chores. Here is how they might plan it, in words. Every code change triggers a quick build through a webhook, so a developer knows within minutes whether a change is safe. Once a night, during a hash-chosen time between one and four in the morning, the full test suite runs against the latest main branch, and the result is waiting in the team chat by nine. Once a week, early on Monday, a scan checks libraries and container images for newly announced weaknesses. Every Sunday, a cleanup job removes old packages and stops unused test servers. Finally, a small monitoring check confirms each morning that the nightly build really happened.

Notice what this plan does well. Each schedule has a purpose. None of them fights another, because they use different windows. Every one of them uses the hash symbol, because none of them needs an exact minute. And the plan includes a watcher for the watchers, so silence is noticed. A team can write a plan like this on a single page and revisit it every quarter.

Thinking about cost

Scheduled builds feel free, because nobody clicks anything, but each run uses real machines. On your own servers, that means electricity and wear, and on rented cloud machines it means a monthly bill. A job that runs every ten minutes on a large machine can quietly cost more than an entire team’s coffee budget. To keep costs sensible, ask three questions for every schedule. How often does it truly need to run? How big a machine does it truly need? And can it stop early when nothing has changed? Teams that ask these questions regularly often cut their scheduled workload by a third without losing any real safety.

!
Do not schedule what should be triggered

A build that runs every five minutes just to see if code changed is a sign of a design problem. Switch to a webhook. Reserve schedules for work that truly belongs to the clock.

SSecurity Around Scheduled Builds

A scheduled build runs unattended, often at night, with real permissions. That makes it worth protecting well.

Everyday Analogy

Think of a night cleaner with a set of keys who works alone in the building. You trust the cleaner, but you give only the keys that the job needs, you keep a log of visits, and you check that nobody swapped the cleaner for a stranger. Scheduled builds work while nobody watches, so they deserve the same care.

RiskWhy it matters for scheduled buildsHow to reduce it
Over-powerful credentialsA night job with a master key is a prize targetGive each job only the secrets it needs, and rotate them
Nobody watchingA hijacked or broken job could run for hours unnoticedSend alerts on failure and unusual duration
Changes to the scheduleAn attacker or a mistake could add a heavy or harmful timerKeep schedules in reviewed pipeline files, and limit who can edit jobs
Builds on the controllerHostile code could read secrets stored thereRun all builds on agents, with zero executors on the controller
Untrusted code on a timerScheduled runs of unreviewed branches can execute strangers’ codeSchedule only trusted branches
Secrets in logsOvernight logs may be read later by many peopleUse the credentials store, which hides values, and never print secrets

Permissions

Jenkins can limit who may create jobs, edit schedules, and start or stop builds. Follow least privilege, meaning each person gets only the access their work needs. Anyone who can edit a schedule can change when code runs, and anyone who can edit the job can change what runs. Treat those rights carefully.

!
Warning

Never rely on “nobody uses it at night” as a security plan. Attackers often prefer quiet hours precisely because nobody is watching. Alerts and least-privilege secrets protect you when you are asleep.

MMonitoring, Logging and Alerting

The worst scheduled build is one that silently stops running. Good monitoring means you learn about problems from Jenkins, not from a customer.

Everyday Analogy

A smoke alarm is only useful if it has a working battery. A scheduled build without alerts is a smoke alarm with a dead battery. It looks fine until the day you need it. Monitoring is checking the battery.

What to watchWhat it tells youTypical action
Did the build run at all?Whether the schedule is aliveAlert if no build appears within the expected window
Result of each runWhether the work succeededNotify the owner on failure and on recovery
Duration trendWhether runs are slowing downInvestigate before runs overlap the next schedule
Queue wait timeWhether nightly jobs are competing for machinesSpread schedules with H, or add agents
Failure rateHealth of the job and its dependenciesRepair flaky steps and outside dependencies
Disk and retentionWhether history from frequent runs fills storageTighten build discarder rules

Notifications that people will read

A message every night that says “all good” quickly becomes noise, and people learn to ignore it. A message only when something changes, such as the first failure or the first success after failures, gets attention. Send failures to the owner of the job and to the channel of the team that depends on the result. Keep messages short, with a link straight to the build.

Detecting a missing build

Because Jenkins does not replay missed runs, a controller outage or a broken schedule can pass unnoticed. A simple safeguard is a second, independent check that looks for the latest build time of important jobs and alerts if it is older than expected. Many monitoring systems, such as Prometheus with Grafana, can chart the time since the last successful build and raise an alarm. This is sometimes called a “dead man’s switch,” because it alerts you when the expected signal stops.

i
Tip

Every scheduled job should have an owner’s name in its description and a clear channel for alerts. A red nightly build that belongs to nobody stays red for weeks.

AAdvantages, Disadvantages and Trade-offs

Scheduled builds are simple and powerful, and they also carry hidden costs that are worth knowing.

Advantages

  • Very simple to set up, using a well-known text format
  • Predictable: the team knows when results will appear
  • Perfect for heavy work that runs on idle machines at night
  • Covers tasks unrelated to code changes, such as backups and cleanups
  • Finds problems that appear over time, such as new library weaknesses
  • H spreads load automatically across the day
  • Free, flexible and works with any tool that a build can call

Disadvantages

  • Runs even when nothing changed, wasting machines and money
  • Feedback can be many hours late, since code is only tested at the next run
  • Missed runs are not replayed if Jenkins is down
  • Time zones and daylight saving can cause surprises
  • Overlapping runs can pile up when jobs are slow
  • Failures at night may go unseen without good alerts

Trade-offs to think about

Fresh vs cost

How often to run

More frequent runs give fresher answers but use more machines. Pick the slowest rhythm that still meets the need.

Exact vs spread

Fixed time or H

Exact times suit outside deadlines. H suits everything else and protects the server.

Schedule vs webhook

Clock or change

Webhooks react to change. Schedules cover work that belongs to time. Many projects use both.

Deep vs quick

Test depth

Run quick checks on every change and deep checks on a schedule, so feedback stays fast and coverage stays wide.

Overlap vs wait

Concurrency

Allowing overlap keeps things moving but can clash on shared resources. Waiting is safer but can build a queue.

Form vs file

Where to store it

Web forms are quick. Pipeline files are safer, reviewable and recoverable.

PDesign Patterns and Anti-patterns

A pattern is a proven way to solve a common problem. An anti-pattern is a habit that looks helpful and causes pain later.

Patterns worth copying

Pattern

Fast on change, deep on schedule

Use webhooks for quick checks on every change, and a nightly schedule for the slow, deep suite.

Pattern

H everywhere

Let Jenkins scatter start times so no crowd forms at midnight.

Pattern

Schedule in the pipeline file

Keep the timer next to the code so it is reviewed and recoverable.

Pattern

Stagger by category

Give backups, scans and tests their own hour ranges so they do not compete.

Pattern

Timeouts on every scheduled job

A stuck night build should stop itself instead of blocking an executor until morning.

Pattern

Missing-build alarm

Alert when an expected build did not appear, not only when one fails.

Pattern

Skip when nothing changed

Let a nightly build check whether code changed since the last success and exit early if it did not, saving cost.

Habits to avoid

ANTI-PATTERN 01Avoid
What it looks like

Dozens of jobs are all set to run at the exact stroke of midnight, or at minute zero of every hour.

Why it hurts

The controller and agents receive a sudden wave of builds. Queues grow, builds start late, and everything slows down for a few minutes, again and again.

Do this instead

Use H in the minute field, and choose hour ranges for different kinds of work.

ANTI-PATTERN 02Avoid
What it looks like

A job polls or builds every minute “so we get instant feedback.”

Why it hurts

It wastes machines and floods the history with meaningless runs. Real feedback is still delayed by the length of the build.

Do this instead

Use a webhook for instant reaction, and keep schedules for work that belongs to the clock.

ANTI-PATTERN 03Avoid
What it looks like

A nightly build fails for two weeks and nobody notices, because nobody owns it and nobody reads the messages.

Why it hurts

The nightly build exists to give early warning. If nobody reads it, the warning is lost and problems grow quietly.

Do this instead

Name an owner, alert the right channel, and treat a broken nightly build as a real issue.

ANTI-PATTERN 04Avoid
What it looks like

A job that takes ninety minutes is scheduled every hour.

Why it hurts

Runs overlap or queue up. Each cycle adds to the backlog until builds start hours late.

Do this instead

Make the interval longer than the run, or speed up the job, or add capacity.

ANTI-PATTERN 05Avoid
What it looks like

Schedules are typed into web forms on a server that has grown for years, and nobody remembers what runs when.

Why it hurts

If the server is lost, the schedules vanish with it. Nobody can review a change, and surprise builds appear with no explanation.

Do this instead

Keep schedules in pipeline files or in configuration files stored in version control.

BBest Practices and Common Mistakes

These are lessons experienced teams usually learn the hard way. You can learn them the easy way, by reading them now.

Best practices

  • Always use H unless an exact time is required. It costs nothing and protects the server.
  • Check the preview lines every time. Read “would next run at” and confirm it matches your intention, including the time zone.
  • State the time zone. Put it in the schedule or in the job description so nobody has to guess.
  • Keep schedules in version control. Use pipeline files so changes are reviewed and recoverable.
  • Add timeouts. A stuck scheduled build should stop itself, not block an executor all night.
  • Decide about overlap. Choose deliberately whether concurrent runs are allowed.
  • Limit scheduled work to trusted branches. Do not run nightly jobs for every experimental branch.
  • Skip pointless runs. If nothing changed and nothing needs re-checking, exit early to save money.
  • Set retention rules. Frequent builds create a lot of history, so decide how much to keep.
  • Alert on missing builds. Detect silence, not only failure.
  • Document ownership. Every scheduled job needs an owner and an alert channel.

Common mistakes

  • Assuming the server clock is the team clock. Many servers run on universal time.
  • Forgetting daylight saving. Jobs near the clock change may be skipped or doubled.
  • Using a star with a slash for the minute field. Every job then fires on the same quarter hours. Use H with a step.
  • Believing missed builds are replayed. They are not.
  • Confusing Build periodically with Poll SCM. One always builds, the other builds only on changes.
  • Scheduling the same heavy work in many branches. The load multiplies with each branch.
  • Letting old scheduled builds fill the disk. A build every few minutes creates thousands of records in a month.
  • Editing a pipeline schedule and expecting it to apply at once. The pipeline may need to run once to register the new trigger.
i
Tip

Once a quarter, review the list of scheduled jobs. Ask, “Is this still useful? Is the timing still right? Does someone still own it?” Retiring jobs that no longer matter is one of the cheapest ways to cut cost and noise.

TTroubleshooting: When a Schedule Does Not Behave

Sooner or later a scheduled build does not run when you expect. A calm routine finds the cause quickly.

A simple routine

1

Read the preview

Open the job settings and read the “would last have run” and “would next run” lines. They often reveal a wrong hour or time zone at once.

2

Check the build history

Look at the cause on recent builds. “Started by timer” confirms the schedule works. If nothing appears near the expected time, the request never happened.

3

Check the queue

If the request was made but the build did not start, the queue message will say why, such as waiting for an executor or a label.

4

Check the controller

Was Jenkins running at that minute? Restarts and maintenance windows explain many missing builds.

5

Check the job itself

Is the job disabled? Was the pipeline changed, so the trigger was never registered? Is concurrency blocking a new run?

Common situations and their usual causes

SymptomLikely causeWhat to check
Build runs at the wrong hourServer time zone differs from yoursPreview message, time zone line, server settings
Build never runsJob disabled, schedule not registered, or controller was downJob status, pipeline trigger section, controller uptime
Build runs but starts lateQueue is full, or few executors are freeQueue message, agent capacity, other schedules at that time
Build runs twice in a nightDaylight saving change, or two triggers on the same jobTrigger list, clock change dates
Build skipped on some daysDay-of-week or day-of-month restriction excludes themRead the fields aloud in words
Builds pile up in the queueRun time is longer than the intervalDuration trend, concurrency setting
Changes are not picked upJob uses only a schedule, with no change-based triggerAdd a webhook or Poll SCM if needed
i
Tip

When a schedule seems wrong, say it out loud in words: “At a hash-chosen minute, during hour two, on any day, in any month, Monday to Friday.” If the sentence does not match what you want, the schedule text is wrong.

RReal-World and Industry Examples

Scheduled builds appear in teams of every size and in nearly every industry. Here is how the ideas look in practice.

Large engineering organizations

Companies with thousands of developers commonly run enormous test suites overnight, because there are too many tests to run on every code change. Each morning, developers open a report that shows exactly which tests broke since yesterday. The schedule turns idle night-time machines into a giant safety check.

Open-source projects

Many open-source projects publish “nightly” versions, packages built once a day from the latest code. Volunteers and early users try them and report bugs long before the official release. The nightly schedule is the heartbeat of that feedback loop.

Regulated industries

Banks, hospitals and telecom companies often need recurring compliance checks and evidence collection. A schedule runs the checks, stores the results as artifacts, and keeps a dated record that auditors can review later.

Cloud cost control

Some teams schedule a job that shuts down test servers in the evening and starts them again in the morning. The saved hours add up to a large reduction in the monthly cloud bill.

Security teams

New weaknesses in libraries are announced every day. Security teams schedule daily scans of dependencies and container images so that a new announcement is noticed even if no developer touched the code.

Small teams and startups

A team of five may run a single Jenkins server with one nightly build. It runs the full tests, creates a package for testers, and sends a short message to the team chat. That single schedule replaces an hour of manual work every day.

Lessons that repeat across teams

Look across these examples and a few lessons appear again and again. Successful teams keep quick, change-driven builds separate from slow, time-driven ones. They spread their schedules instead of stacking them. They watch for silence as carefully as for failure. They write schedules in files that people can review. And they keep the number of scheduled jobs small and useful, retiring the ones that no longer earn their cost. None of this requires a large budget. A small team can follow every one of these habits from the first week.

A good schedule is like a good habit: small, regular, and quietly reliable.

FFrequently Asked Questions

Q1What is a scheduled build in the simplest words?
It is a Jenkins build that starts by the clock instead of by a person or a code change. You give the job a schedule written in cron-style text, and Jenkins starts a build whenever the time matches.
Q2What does cron mean?
Cron is an old Unix program that runs tasks at fixed times. Its five-field time format became a standard, and Jenkins reuses that format for schedules.
Q3What are the five fields, in order?
Minute, hour, day of the month, month, and day of the week. A star means any value is allowed in that position.
Q4What does the letter H mean?
H is a Jenkins-only symbol that picks a stable, job-specific value for that field. It spreads different jobs across time, so they do not all start at the same instant, while each job still runs at a predictable time.
Q5Is Jenkins cron the same as the cron on a Linux server?
It looks the same, but it is read by Jenkins, not by the operating system. Jenkins adds the H symbol and handles time zones its own way, so always trust the preview message in Jenkins.
Q6What time zone does a schedule use?
By default, the time zone of the machine where the Jenkins controller runs. You can name a different time zone at the top of the schedule text, so the times below it use that region’s local clock.
Q7What happens if Jenkins is off when the schedule matches?
The build is not run. Jenkins does not replay missed schedules later. It waits for the next matching time, so important jobs need monitoring that notices a missing run.
Q8What is the difference between Build periodically and Poll SCM?
Build periodically always starts a build at the scheduled time. Poll SCM only checks the code repository at the scheduled time and starts a build if something changed.
Q9Should I use polling or a webhook?
Prefer a webhook when possible. It reacts instantly and wastes nothing. Use polling only when the network makes webhooks impossible.
Q10Can I schedule a build every few seconds?
No. The smallest step is one minute, because the schedule checker wakes up once a minute. If you truly need faster reactions, use an event-based trigger.
Q11Why did my scheduled build not run after I changed the pipeline file?
A trigger written inside a pipeline file is registered when the pipeline runs. After adding or changing it, run the job once so Jenkins learns the new schedule.
Q12How can I tell which builds were scheduled?
Open a build and look at its cause. Scheduled runs are marked as started by the timer, which makes them easy to tell apart from manual or code-triggered runs.
Q13How can I avoid wasting resources on scheduled builds?
Schedule only what belongs to the clock, choose the slowest rhythm that still meets the need, skip runs when nothing has changed, set timeouts, and review the list of scheduled jobs regularly.
Q14Can one job have more than one schedule?
Yes. You can put several lines in the schedule box, one under another, and Jenkins starts a build when any line matches. This is useful when you want, for example, a run every hour in working time and a different run at the weekend. Keep the number of lines small so the meaning stays easy to read.
Q15Can I add notes to explain a schedule?
Yes. Lines that begin with a hash sign are treated as comments and ignored by Jenkins, so you can explain why a time was chosen. This is a small habit that saves teammates a lot of guessing later.
Q16Does a scheduled build skip the queue?
No. A scheduled build joins the same queue as every other build and waits for a free executor on a matching agent. The schedule decides only when the request is made.

SSummary and Key Takeaways

A scheduled build is Jenkins’ alarm clock. Used well, it turns quiet hours into useful work.

Key Takeaways

  • What it is: A scheduled build starts by the clock, using a five-field cron-style schedule, whether or not any code has changed. In the settings it is called Build periodically.
  • How to read it: The fields are minute, hour, day of month, month and day of week. Stars, commas, dashes and slashes mean any, list, range and step. Say the schedule aloud in words to check it.
  • Why H matters: The hash symbol gives each job a stable, different time, so hundreds of jobs do not all start at midnight. Use it unless an outside deadline needs an exact time.
  • Mind the clock: Schedules follow the controller’s time zone unless you say otherwise, and daylight saving can skip or double runs. Always read the preview lines.
  • Know the limits: The clock checks once a minute, missed runs are not replayed, and long runs can overlap or pile up. Decide on concurrency and timeouts deliberately.
  • Choose the right trigger: Use schedules for work that belongs to time, such as nightly tests, scans, backups and reports. Use webhooks for reacting to code changes, and combine both for the best coverage.
  • Keep it healthy: Store schedules in pipeline files, protect secrets, alert on failure and on silence, name an owner, and review your scheduled jobs regularly.