Skip to content

Cron Expressions Explained: Every 5 Minutes, Weekdays at 9am, and Beyond

By DevToolSite Editorial

Cron expressions are five tiny fields that quietly run the world’s backups, reports, and cleanup jobs. They’re also famously easy to get subtly wrong — a schedule that fires every minute when you wanted every hour, or a “weekly” job that runs eight times a day. This guide explains the syntax from first principles and gives you verified, copy-ready expressions for the schedules people actually search for.

Want to check an expression right now? Paste it into the Cron Parser to get a plain-English description and the next five run times in UTC.

The five fields

┌───────── minute (0–59)
│ ┌─────── hour (0–23)
│ │ ┌───── day of month (1–31)
│ │ │ ┌─── month (1–12)
│ │ │ │ ┌─ day of week (0–7, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *  command-to-run

Read left to right: “at this minute, of this hour, on this day of the month, in this month, on this day of the week.” A * means “every value”. So * * * * * runs every minute of every day — the most expensive typo in operations history.

Each field supports four building blocks:

SyntaxMeaningExample
*every value* in minutes = all 60
,list1,15,30 = at those minutes
-range1-5 in day-of-week = Mon–Fri
/step*/5 = every 5th value

That’s the entire language. Everything else is composition.

The schedules everyone needs

Every 5 minutes

*/5 * * * *

*/5 in the minute field expands to 0,5,10,…,55 — twelve runs per hour, on the clock, not “five minutes after the last run finished”. See the full breakdown on the cron every 5 minutes reference page.

Every 15 minutes / every 30 minutes

*/15 * * * *     # :00, :15, :30, :45
*/30 * * * *     # :00 and :30

Note that steps divide from 0, not from an arbitrary offset. */45 does not mean “every 45 minutes” — it fires at :00 and :45, then :00 again. For a true 45-minute cadence you need a list: 0,45 0-23/3 * * * gets closer, but honestly, redesign the job.

Hourly, at a specific minute

0 * * * *      # every hour at :00
15 * * * *     # every hour at :15

Staggering the minute (e.g. 17 * * * *) is a free win: it keeps your job off the thundering-herd spike at the top of the hour when every other cron on the box also fires.

Daily at midnight / at 2:30am

0 0 * * *      # 00:00 every day
30 2 * * *     # 02:30 every day

Nightly jobs should account for DST if the server runs in a local time zone — 2:30am may not exist (spring forward) or may happen twice (fall back) on transition days. Running servers in UTC avoids the entire class of bugs.

Weekdays at 9am

0 9 * * 1-5

Day-of-week 1–5 is Monday through Friday. This is the classic “business report” schedule. Combined day-of-month and day-of-week fields have a trap — see below.

Weekly and monthly

0 0 * * 0      # every Sunday at midnight
0 3 1 * *      # 1st of every month at 03:00
0 3 1 1 *      # January 1st at 03:00 (yearly)

Special strings

Most modern crons accept shortcuts:

@hourly    # = 0 * * * *
@daily     # = 0 0 * * *
@weekly    # = 0 0 * * 0
@monthly   # = 0 0 1 * *
@reboot    # once, at daemon startup

@reboot has no five-field equivalent and is genuinely useful for starting user-level services.

The day-of-month / day-of-week trap

This is the single most misunderstood rule in cron:

0 0 13 * 5

You might read this as “midnight on Friday the 13th”. Classic Vixie cron reads it as “midnight on the 13th OR any Friday” — when both day fields are restricted (not *), the job fires when either matches. You’d get every Friday plus the 13th of every month.

To get true Friday-the-13th behavior, restrict one field and test the other in the command:

0 0 13 * * [ "$(date +\%u)" = 5 ] && /path/to/job

(Some newer implementations, e.g. Quartz-style schedulers, use AND semantics or forbid specifying both — always check your platform. The cron parser tool shows the standard interpretation.)

More traps worth knowing

  • % is special in crontab. An unescaped % in the command starts stdin for the job. date +%Y in a crontab must be date +\%Y.
  • Seconds don’t exist in standard cron. Six-field expressions (with seconds) are a Quartz/spring/cron-parser extension, not something /etc/crontab understands.
  • Day-of-week 7 is Sunday on most systems, but 0 is the portable choice.
  • Environment is minimal. cron runs with a bare PATH (often /usr/bin:/bin) and no shell profile. Use absolute paths or set PATH= at the top of the crontab.
  • Overlapping runs. A job scheduled every 5 minutes that takes 7 minutes to run will overlap itself. Guard with flock -n /tmp/job.lock command.

A workflow that prevents 2am pages

  1. Write the expression.
  2. Paste it into the Cron Parser and read the English description out loud — does it match your intent?
  3. Check the next five run times, especially around month boundaries and weekends.
  4. Deploy with logging and a lock, then verify the first actual run in the logs.

The whole loop takes a minute and catches nearly every cron mistake before it catches you. For more ready-made schedules, browse the cron expression library — every entry includes platform-specific equivalents for crontab, Quartz, Kubernetes CronJobs and more.

Advertisement
Ad slot · blog-in-article
#cron#linux#devops