Common Cron Expressions — Comprehensive Cron Schedule Reference
Cron expressions are the backbone of task scheduling on Unix-like systems. This reference covers 40+ common cron expressions, from every-minute monitoring to yearly audits, with human-readable explanations and real-world use cases.
Whether you are configuring a Linux crontab, setting up Kubernetes CronJobs, orchestrating CI/CD pipelines, or scheduling cloud infrastructure tasks, this guide helps you find the right expression fast.
Understanding Cron Syntax
A standard cron expression consists of five space-separated fields:
* * * * *
| | | | |
| | | | +---- Day of week (0-7, 0=Sun, 7=Sun)
| | | +------ Month (1-12, or JAN-DEC)
| | +-------- Day of month (1-31)
| +---------- Hour (0-23)
+------------ Minute (0-59)
Each field accepts:
*— Wildcard, matches all valid valuesN— Specific value (e.g.,5in minute field = minute 5)*/N— Step, every N units (e.g.,*/15= every 15 minutes)N,M,O— List, multiple specific values (e.g.,0,30= minute 0 and 30)N-M— Range (e.g.,9-17= hours 9 through 17)L— Last (day of month or day of week only, e.g.,Lin day-of-month = last day)W— Nearest weekday (day of month only, e.g.,15W= nearest weekday to the 15th)#— Nth occurrence (day of week only, e.g.,1#2= second Monday)
Special Characters Explained
The Asterisk (*) — Wildcard
The most common character. * means "every possible value" for that field.
0 * * * * — At minute 0 of every hour (hourly)
* * * * * — Every single minute
The Slash (/) — Step
Defines increments. */N means "every N units".
*/5 * * * * — Every 5 minutes
0 */2 * * * — Every 2 hours
The Comma (,) — List
Specifies multiple discrete values.
0 6,18 * * * — At 6 AM and 6 PM daily
0 0 1,15 * * — Midnight on the 1st and 15th of every month
The Hyphen (-) — Range
Defines a contiguous range of values.
0 9-17 * * 1-5 — Every hour from 9 AM to 5 PM, Monday to Friday
0 0 * * 1-5 — Midnight Monday through Friday
The L Character — Last
Represents the "last" valid value.
0 0 L * * — Midnight on the last day of the month
0 0 * * 5L — Midnight on the last Friday of the month
Common Mistakes When Writing Cron Expressions
Mistake 1: Confusing Day of Month and Day of Week
When both day-of-month and day-of-week are specified (not *), the job runs when either matches. This is a common source of unexpected behavior.
0 0 1 * 1 — Runs on the 1st of the month AND on every Monday, not the first Monday.
Mistake 2: Using 7 for Sunday
Most cron implementations accept both 0 and 7 for Sunday, but not all. Always prefer 0 for Sunday for maximum compatibility.
Mistake 3: Forgetting That Cron Uses the System Timezone
Cron runs in the system's timezone, which is usually UTC on servers. Always verify your expected timezone, especially for production deployments.
Mistake 4: Off-by-One in Minute Field
A common error: 0 0 * * * runs at midnight (00). 0 1 * * * runs at 1 AM. The range is 0-23 for hours.
Mistake 5: Assuming Cron Jobs Run If the System Was Down
Cron does not catch up on missed jobs. If the system is off during a scheduled time, that execution is skipped permanently.
Cron in Different Systems
Linux Cron (crontab)
Standard cron provided by most Linux distributions. Edit with crontab -e, list with crontab -l.
# Run backup daily at 2 AM
0 2 * * * /usr/local/bin/backup.sh
# Rotate logs every Sunday at 3 AM
0 3 * * 0 /usr/local/bin/logrotate.sh
# Health check every 5 minutes
*/5 * * * * /usr/local/bin/healthcheck.shKubernetes CronJobs
Kubernetes uses standard cron expressions with the addition of a timezone field in newer versions.
apiVersion: batch/v1
kind: CronJob
metadata:
name: cleanup
spec:
schedule: "0 1 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: cleanup
image: busybox
command: ["/bin/sh", "-c", "cleanup.sh"]
restartPolicy: OnFailureCI/CD Pipeline Cron (GitHub Actions)
name: Nightly Build
on:
schedule:
- cron: '0 3 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm run buildAWS CloudWatch Events / EventBridge
{
"ScheduleExpression": "cron(0 6 * * ? *)",
"Name": "morning-cleanup",
"State": "ENABLED"
}Spring Boot (Java)
@Component
public class ScheduledTasks {
@Scheduled(cron = "0 0 4 * * ?")
public void performCleanup() {
// Runs daily at 4 AM
}
@Scheduled(cron = "0 */30 9-17 * * 1-5")
public void checkSlaCompliance() {
// Every 30 minutes during business hours
}
}Cron Expression Cheat Sheet by Frequency
| Frequency | Expression | Description |
|---|---|---|
| Every minute | * * * * * |
Runs 1,440 times daily |
| Every 5 minutes | */5 * * * * |
Standard monitoring interval |
| Every 15 minutes | */15 * * * * |
Typical metric collection |
| Every 30 minutes | */30 * * * * |
Queue polling interval |
| Hourly | 0 * * * * |
On the hour |
| Daily at midnight | 0 0 * * * |
End-of-day processing |
| Daily at 6 AM | 0 6 * * * |
Pre-business data prep |
| Weekly (Monday) | 0 0 * * 1 |
Start-of-week tasks |
| Monthly (1st) | 0 0 1 * * |
Billing, reporting |
| Yearly (Jan 1) | 0 0 1 1 * |
Annual maintenance |
| Business hours | 0 9-17 * * 1-5 |
Weekdays only |
| Every 10 min weekdays | */10 * * * 1-5 |
Business-hours monitoring |
Cron Expression FAQ
What does */5 in cron mean?
*/5 in any field means "every 5 units". For the minute field, it means the job runs at minutes 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, and 55.
Can cron expressions run on specific timezones?
Standard cron uses the system timezone. Some implementations (Kubernetes 1.27+, Quartz Scheduler) support timezone specification. For Linux crontab, set CRON_TZ=America/New_York at the top of your crontab file.
What is the difference between cron and anacron?
cron assumes the system is always running. anacron is designed for systems that may be off during scheduled times — it catches up on missed jobs at the next boot. anacron is ideal for laptops and desktops.
Can I use cron with seconds?
Standard Unix cron does not support seconds. For second-level precision, use systemd timers, Quartz Scheduler, or a custom sleep loop within a cron job.
What does ? mean in cron expressions?
The ? character is used in Quartz-style cron expressions (AWS CloudWatch, Spring, Terracotta). It means "no specific value" and is used where you specify either day-of-month or day-of-week but not both.
How do I test a cron expression before deploying?
Use the LangStop Cron Helper to build and validate expressions interactively. It shows the next execution times and helps catch syntax errors before you deploy to production.
Why is my cron job not running?
Common causes: incorrect syntax (run through a validator), wrong timezone assumption, environment variables not set, missing execute permissions on the script, or the cron daemon not running (systemctl status cron).
Does cron handle daylight saving time?
Yes, but carefully. Jobs scheduled during a DST transition hour may run twice (fall back) or not at all (spring forward). For critical jobs, use UTC to avoid DST complications.
What is the non-standard syntax (6-field cron)?
Some systems (Quartz, CloudWatch) use 6 fields: seconds, minutes, hours, day-of-month, month, day-of-week, with ? replacing * for fields you want left unspecified.
Related Resources
- Cron Helper — Build and test cron expressions interactively
- Cron Expression Validator — Validate cron syntax
- Unix Time Converter — Convert timestamps across timezones
Browse the 40+ cron expressions above and copy the ones you need. For custom schedules, use the interactive Cron Helper to build and test your expression.