Blog
Guides

Cron syntax cheat sheet, with Python examples

DK
Dan Kowalsky
Founder ·

A cron expression is five fields separated by spaces that say when a job runs. The same syntax works in a Linux crontab, GitHub Actions, most cloud schedulers and Callables, so it's worth learning once. This page is the reference; for how to actually set up a schedule, see how to run a Python script on a schedule.

The five fields

┌───────────── minute        0–59
│ ┌─────────── hour          0–23
│ │ ┌───────── day of month  1–31
│ │ │ ┌─────── month         1–12 (or JAN–DEC)
│ │ │ │ ┌───── day of week   0–6, Sunday = 0 (or SUN–SAT)
│ │ │ │ │
* * * * *  command to run

A job runs when the current time matches every field. 0 9 * * 1 means minute 0, hour 9, any day of the month, any month, on Monday: 9:00 every Monday.

Special characters

CharacterMeaningExampleRuns
*Any value* * * * *Every minute
,A list0 9,17 * * *9:00 and 17:00
-A range0 9 * * 1-59:00, Monday to Friday
/A step*/15 * * * *Every 15 minutes

You can combine them: 0 8-18/2 * * 1-5 runs every two hours from 8:00 to 18:00 on weekdays.

The expressions you'll use most

ScheduleExpression
Every minute* * * * *
Every 5 minutes*/5 * * * *
Every 15 minutes*/15 * * * *
Every hour, on the hour0 * * * *
Every hour at 30 past30 * * * *
Every 6 hours0 */6 * * *
Every day at midnight0 0 * * *
Every day at 9am0 9 * * *
Twice a day, 9am and 5pm0 9,17 * * *
Every weekday at 9am0 9 * * 1-5
Every Monday at 8:30am30 8 * * 1
Every Sunday at 2am0 2 * * 0
First day of every month at midnight0 0 1 * *
The 15th of every month at noon0 12 15 * *
Every quarter (Jan, Apr, Jul, Oct 1st)0 0 1 1,4,7,10 *
Once a year, January 1st0 0 1 1 *

Many cron implementations also accept shortcuts like @hourly, @daily, @weekly and @reboot. They're handy in a crontab, but not every scheduler supports them (GitHub Actions doesn't), so the five-field form is the safe choice.

Gotchas that run jobs at the wrong time

  • Time zones. A crontab uses the server's time zone, GitHub Actions always uses UTC, and cloud schedulers vary. 0 9 * * * on a UTC server is 4am or 5am in New York, depending on daylight saving time. In Callables you pick a time zone in the web app, and schedules declared in code use UTC.
  • Day of month and day of week together. If both are set, classic cron runs the job when either matches, not both. 0 9 1 * 1 runs on the 1st of the month and on every Monday, not only on Mondays that fall on the 1st.
  • Sunday is 0, and often 7 too. Most crons accept both. Stick to 0 for portability.
  • Steps start from the bottom of the range. */7 in the minute field runs at 0, 7, 14 … 56, then 0 again, so the gap across the hour is 4 minutes, not 7. Steps only divide evenly when they're a factor of the range (for minutes: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30).
  • No seconds field. Standard cron's smallest unit is a minute. Some tools (Quartz, some Spring schedulers) add a sixth field for seconds; those expressions won't work in a crontab.

Check an expression in Python

Before trusting an expression, print the next few times it will run. The croniter package does this:

from datetime import datetime

from croniter import croniter

itr = croniter("0 9 * * 1-5", datetime(2026, 11, 6, 12, 0))  # a Friday, at noon
for _ in range(3):
    print(itr.get_next(datetime))

# 2026-11-09 09:00:00
# 2026-11-10 09:00:00
# 2026-11-11 09:00:00

When you set a schedule in Callables, the editor shows the next few run times as you type, so you see straight away whether 0 9 1 * 1 means what you think.

Using an expression with a Python script

In a crontab, give absolute paths and send the output to a log file, because cron runs with a minimal environment and throws away output by default:

0 9 * * 1-5 /home/me/app/.venv/bin/python /home/me/app/report.py >> /home/me/app/report.log 2>&1

In Callables, the same expression goes in the schedule editor, or in the decorator if the schedule should live with the code:

from callables import deploy


# Every weekday at 9am UTC
@deploy(title="Daily report", schedule="0 9 * * 1-5")
def daily_report(days: int = 1) -> str:
    ...

Every run is then saved with its logs, so a job that failed at 9am doesn't stay a mystery. For the full comparison of cron, Task Scheduler, GitHub Actions and Callables, see how to run a Python script on a schedule.

Turn your scripts into tools your team can run

Add @deploy to a Python function and push. Your team gets a form, schedules and run history.

See how it works

Keep reading