# Cron Expression Examples: Syntax Explained With 20 Schedules

> The five cron fields, how *, commas, ranges and steps work, shortcuts like @daily, and ready-to-copy crontab examples: every 5 minutes, weekdays at 8:30, the first of every month and more.

Source: https://widgetpantry.com/en/cron-expression-examples · Türkçe: https://widgetpantry.com/tr/cron-ifadesi-nasil-yazilir

Published 2026-11-21

Cron is the scheduler that runs commands at set times on Linux and macOS, and the same syntax drives GitHub Actions schedules, Kubernetes CronJobs and many cloud services. A cron expression is five fields separated by spaces. Below is what each field means, the special characters, and examples you can copy. To see exactly when an expression will fire, the [Cron Expression Parser](https://widgetpantry.com/en/cron-expression-parser) lists its next five runs.

## The five fields: minute, hour, day, month, weekday

Fields are written left to right in this order. A * in a field means "every value".

| Position | Field | Allowed values |
| --- | --- | --- |
| 1 | Minute | 0–59 |
| 2 | Hour | 0–23 |
| 3 | Day of month | 1–31 |
| 4 | Month | 1–12 or JAN–DEC |
| 5 | Day of week | 0–6 (0 = Sunday, 7 is Sunday too) or SUN–SAT |

## Special characters

Four characters cover almost any schedule:

| Character | Meaning | Example |
| --- | --- | --- |
| * | Every value | * in the hour field: every hour |
| , | List | 9,18: at 9 and 18 |
| - | Range | 1-5: Monday to Friday |
| / | Step | */15: every 15 minutes |

## Cron expression examples

Times follow the time zone of the machine running cron.

| Expression | Runs |
| --- | --- |
| * * * * * | Every minute |
| */5 * * * * | Every 5 minutes |
| */15 * * * * | Every 15 minutes |
| 0 * * * * | Every hour, on the hour |
| 0 */2 * * * | Every 2 hours, on the hour |
| 0 9 * * * | Every day at 09:00 |
| 0 9,18 * * * | Every day at 09:00 and 18:00 |
| 30 8 * * 1-5 | Weekdays at 08:30 |
| */15 9-17 * * 1-5 | Every 15 minutes from 09:00 to 17:45 on weekdays |
| 0 22 * * 1-5 | Weeknights at 22:00 |
| 0 10 * * 6,0 | Weekends at 10:00 |
| 0 0 * * 0 | Every Sunday at midnight |
| 0 0 1 * * | Midnight on the 1st of every month |
| 0 0 1,15 * * | The 1st and 15th of every month |
| 15 14 1 * * | 14:15 on the 1st of every month |
| 0 12 1 */3 * | Quarterly (Jan, Apr, Jul, Oct) on the 1st at 12:00 |
| 0 3 1 1 * | Every year on 1 January at 03:00 |

## Shortcuts: @daily, @hourly and friends

Most cron implementations accept short names for common schedules:

| Shortcut | Same as | Meaning |
| --- | --- | --- |
| @hourly | 0 * * * * | Every hour, on the hour |
| @daily / @midnight | 0 0 * * * | Every day at midnight |
| @weekly | 0 0 * * 0 | Every Sunday at midnight |
| @monthly | 0 0 1 * * | Midnight on the 1st of every month |
| @yearly / @annually | 0 0 1 1 * | Midnight on 1 January |

## Adding a job to crontab

Run crontab -e to open your user's schedule. Each line is one job: the five fields, then the command. Using full paths and redirecting output to a log file makes problems much easier to diagnose. crontab -l lists the saved jobs.

```
# crontab -e  →  one job per line
# min hour day month weekday  command
*/5 * * * *    /usr/local/bin/check-queue.sh
30 8 * * 1-5   /home/app/send-report.sh >> /var/log/report.log 2>&1
0 3 * * 0      /home/app/backup.sh
```

## Common mistakes

When a cron job fires at the wrong time, it is usually one of these:

- Restricting both day fields: if day of month and day of week are both set, cron runs when either matches (OR, not AND). 0 0 13 * 5 means "the 13th and every Friday", not "Friday the 13th".
- Time zones: servers usually run on UTC. For 9 am in New York (UTC−5 in winter), a UTC server needs 0 14 * * *, and daylight saving time shifts it by an hour.
- Leaving the minute as *: * 9 * * * runs every minute from 09:00 to 09:59, not once. Use 0 9 * * * for once.
- Expecting seconds: classic cron has no seconds field. Quartz and Spring add one at the front (6 fields); those expressions don't work in crontab.
- Steps reset every hour: */7 in the minute field fires at 0, 7, 14 … 56 and then at 0 again, so it is not exactly every 7 minutes.

## GitHub Actions and cloud schedulers

GitHub Actions' schedule trigger uses the same five fields, but times are always UTC and the shortest interval is 5 minutes; at busy times runs can start a few minutes late. Kubernetes CronJobs also use five fields and default to the control plane's time zone.

```
# .github/workflows/nightly.yml
on:
  schedule:
    - cron: "0 3 * * *"   # 03:00 UTC every day
```

## Frequently asked questions

### Is Sunday 0 or 7 in cron?

Both. In the day-of-week field 0 and 7 both mean Sunday; Monday is 1 and Saturday is 6.

### Can cron run every 30 seconds?

Not directly; the smallest unit is one minute. The usual workaround is two crontab lines for the same job with sleep 30 in front of the second, or a scheduler with second precision such as a systemd timer.

### Why is my cron job not running?

The usual causes: the command has no full path (cron's PATH is minimal), the script is not executable, environment variables are not loaded, or the time zone is not what you expected. Redirecting output to a log file shows which.

### Can cron run on the last day of the month?

Classic cron has no "last day" symbol. The common trick is to run on days 28–31 and have the script check whether tomorrow is the 1st. Some libraries such as Quartz support an L character for this.

## Use the tool

- [Cron Expression Parser](https://widgetpantry.com/en/cron-expression-parser): Cron expression parser: explain a crontab line field by field and list the next 5 run times in your time zone or UTC. Supports @daily, */5, ranges, lists and names.
