Cron Monitoring

Cron Expressions: A Complete Guide with Examples.

Written by noc724 team4 min readUpdated Oct 18, 2026

A cron expression is five short fields that describe "when". They are compact, powerful and easy to get subtly wrong - a job that should run once a day can run every minute of 3 a.m. with a single misplaced asterisk. This guide explains each field and gives you schedules you can copy.

Key takeaways

  • Standard cron has five fields: minute, hour, day of month, month and day of week.
  • *, ,, - and / combine into almost any schedule.
  • * 3 * * * runs 60 times between 03:00 and 03:59; you probably meant 0 3 * * *.
  • Cron uses the server's time zone unless your platform says otherwise.
  • Some tools (Quartz, cloud schedulers) add a seconds or year field - check before pasting.
Downtime happens. Get notified!

noc724 checks your websites, servers and APIs around the clock and alerts you by SMS, Telegram or Bale the moment something breaks.

Register for FREE

The five fields

┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12 or JAN-DEC)
│ │ │ │ ┌─ day of week (0-7 or SUN-SAT; 0 and 7 are Sunday)
│ │ │ │ │
* * * * *  command

A job runs when the current time matches all fields - with one exception for the two day fields, explained below.

Special characters

CharacterMeaningExampleRuns
*any value* * * * *every minute
,list0 8,12,18 * * *at 08:00, 12:00 and 18:00
-range0 9-17 * * *every hour from 09:00 to 17:00
/step*/10 * * * *every 10 minutes
a-b/nstep within range0 8-20/4 * * *08:00, 12:00, 16:00, 20:00

Steps count from the start of the range: */7 in the minute field means 0, 7, 14 ... 56, then 0 again - not "every 7 minutes" across the hour boundary.

Ready-made schedules

ExpressionSchedule
*/5 * * * *every 5 minutes
0 * * * *every hour, on the hour
30 2 * * *every day at 02:30
0 9 * * 1-5weekdays at 09:00
0 0 * * 0every Sunday at midnight
0 6 1 * *the 1st of each month at 06:00
0 0 1 1 *once a year, 1 January at midnight
15 14 * * 6Saturdays at 14:15

In Iran, where the working week usually runs Saturday to Wednesday, "working days at 09:00" is 0 9 * * 6,0-3.

You can build and check expressions with the cron expression generator.

Shortcuts

Many cron implementations accept named shortcuts:

ShortcutEquivalent
@hourly0 * * * *
@daily / @midnight0 0 * * *
@weekly0 0 * * 0
@monthly0 0 1 * *
@yearly / @annually0 0 1 1 *
@rebootonce when cron starts

Common mistakes

Forgetting the minute

* 3 * * * means every minute during the 3 o'clock hour. For "once at 03:00", write 0 3 * * *.

Both day fields restricted

If day of month and day of week are both set, the job runs when either matches. 0 9 13 * 5 runs on every 13th *and* every Friday - not only on Friday the 13th. Restrict one day field and check the other inside the script if you need both.

Impossible dates

0 0 31 2 * never runs: February has no 31st. "The last day of the month" isn't expressible in standard cron; run on days 28-31 and let the script check whether tomorrow is the 1st:

0 23 28-31 * * [ "$(date -d tomorrow +\%d)" = "01" ] && /opt/app/month-end.sh

Time zones and daylight saving

Cron follows the server's local time. On servers that observe daylight saving, a job scheduled in the skipped hour may not run and one in the repeated hour may run twice. Running servers in UTC avoids both problems; some cron versions also support a CRON_TZ variable.

Different dialects

Quartz (Java), Spring and some cloud schedulers use six or seven fields with seconds first and sometimes ? for "no specific value". An expression copied between systems can silently mean something else.

Testing an expression

  1. Read it aloud field by field: "minute 0, hour 3, any day, any month, any weekday".
  2. List the next few run times with a generator before deploying.
  3. Watch the first real run in the cron log.
  4. Add a heartbeat monitor so a schedule that never fires raises an alert instead of going unnoticed.

Frequently asked questions

  • Standard cron's smallest unit is one minute. Use two entries, one with sleep 30 before the command, or use a systemd timer, which supports seconds.

  • No. If the server was off at the scheduled time, the run is skipped. anacron and systemd timers with Persistent=true can run missed jobs after boot.

  • Sunday. Both 0 and 7 mean Sunday, and 1 is Monday.

Share this article:XTelegramLinkedInFacebookReddit
noc724

Written by

The noc724 team

Uptime monitoring engineers

We build and run noc724, an uptime monitoring service that checks websites, servers and APIs from several cities in Iran. These guides come from the problems we and our users run into while keeping services online.

Contact the team

Expert on:Cron Monitoring

Questions?Contact Support
Feature suggestions?Share

Recent Articles