Cron syntax
┌───────────── minute (0–59)
│ ┌─────────── hour (0–23)
│ │ ┌───────── day of month (1–31)
│ │ │ ┌─────── month (1–12 or JAN–DEC)
│ │ │ │ ┌───── day of week (0–6 or SUN–SAT, 7 = Sunday)
│ │ │ │ │
* * * * * command
| Symbol | Meaning | Example |
|---|---|---|
* | Any value | * * * * *: every minute |
, | List of values | 0 8,12,18 * * *: at 8:00, 12:00 and 18:00 |
- | Range | 0 9-17 * * *: every hour from 9:00 to 17:00 |
/ | Step | */10 * * * *: every 10 minutes |
@daily etc. | Shortcut macros | @hourly, @weekly, @monthly, @yearly |
Cron expression examples
Each example has its own page with the next run times, a field-by-field breakdown, and ready-to-paste versions for crontab, Kubernetes, GitHub Actions, systemd and AWS.
Every few minutes
* * * * * |
Every minute |
* * * * * |
Every 30 seconds |
*/2 * * * * |
Every 2 minutes |
*/3 * * * * |
Every 3 minutes |
*/5 * * * * |
Every 5 minutes |
*/10 * * * * |
Every 10 minutes |
*/15 * * * * |
Every 15 minutes |
*/20 * * * * |
Every 20 minutes |
*/30 * * * * |
Every 30 minutes |
*/45 * * * * |
Every 45 minutes |
*/5 9-17 * * 1-5 |
Every 5 minutes during business hours |
Hourly
0 * * * * |
Every hour |
30 * * * * |
Every hour at half past |
0 */2 * * * |
Every 2 hours |
0 */3 * * * |
Every 3 hours |
0 */4 * * * |
Every 4 hours |
0 */6 * * * |
Every 6 hours |
0 */8 * * * |
Every 8 hours |
0 */12 * * * |
Every 12 hours |
0 9-17 * * 1-5 |
Every hour during business hours |
Daily
0 0 * * * |
Every day at midnight |
0 1 * * * |
Every day at 1 AM |
0 2 * * * |
Every day at 2 AM |
0 3 * * * |
Every day at 3 AM |
0 6 * * * |
Every day at 6 AM |
0 8 * * * |
Every day at 8 AM |
0 9 * * * |
Every day at 9 AM |
0 12 * * * |
Every day at noon |
0 17 * * * |
Every day at 5 PM |
59 23 * * * |
Every day at 11:59 PM |
0 0,12 * * * |
Twice a day |
0 0 */2 * * |
Every other day |
Weekly
0 9 * * 1-5 |
Every weekday at 9 AM |
0 10 * * 6,0 |
Every Saturday and Sunday at 10 AM |
0 0 * * 1 |
Every Monday |
0 9 * * 1 |
Every Monday at 9 AM |
0 17 * * 5 |
Every Friday at 5 PM |
0 0 * * 0 |
Every Sunday |
0 9 * * 1 |
Every other week |
Monthly and yearly
0 0 1 * * |
Every month |
0 0 15 * * |
On the 15th of every month |
0 0 1,15 * * |
Twice a month |
55 23 28-31 * * |
On the last day of the month |
0 9 1-7 * * |
On the first Monday of the month |
0 0 1 */3 * |
Every quarter |
0 0 1 */6 * |
Every 6 months |
0 0 1 1 * |
Every year |
Cron in GitHub Actions and Kubernetes
GitHub Actions
on:
schedule:
- cron: '30 6 * * 1-5' # 06:30 UTC, Monday to Friday
GitHub runs schedules in UTC on a best-effort basis. Jobs can start several minutes late at busy times, and scheduled workflows in inactive repositories are disabled after 60 days.
Kubernetes CronJob
apiVersion: batch/v1
kind: CronJob
metadata:
name: nightly-report
spec:
schedule: "0 2 * * *"
timeZone: "America/New_York" # Kubernetes 1.27+
jobTemplate:
spec:
template:
spec:
containers:
- name: report
image: ghcr.io/acme/report:1.0
restartPolicy: OnFailure
Troubleshooting a cron job that doesn't run
- Check the time zone. The server may be in UTC while you think in local time.
-
Use absolute paths. Cron runs with a minimal
PATHand no login shell, sonodeorpythonmay not be found. Use/usr/bin/python3. -
Escape
%. In a crontab line, an unescaped%means a newline. Writedate +\%F. -
Log the output. Append
>> /var/log/myjob.log 2>&1to see errors. - End the crontab with a newline. Some cron versions ignore a last line without one.
Frequently asked questions
How do I generate a cron expression?
Click Build above, choose how often the job should run (every few minutes, hours, days, weeks, months or once a year) and pick the times and days. The expression updates as you click, with its plain-English meaning and the next run times underneath, so you can confirm it before pasting it into crontab or a CI config.
What does * * * * * mean in cron?
Five asterisks mean "every minute of every hour of every day". The five fields are, in order: minute (0–59), hour (0–23), day of month (1–31), month (1–12) and day of week (0–6, Sunday = 0). An asterisk means "any value".
How do I run a cron job every 5 minutes?
Use */5 * * * *. The /5 step means "every 5th value" of the minute field, so the job runs at :00, :05, :10 and so on. Similarly, 0 */2 * * * runs every two hours on the hour.
What time zone does cron use?
Classic cron uses the system time zone of the server. Kubernetes CronJobs use the kube-controller-manager’s time zone, usually UTC, unless you set spec.timeZone. GitHub Actions schedules always run in UTC. Choose the scheduler’s named IANA time zone above to check run times. The preview also shows each instant in UTC.
Why does 0 0 1 * 1 run on more days than I expected?
When both day of month and day of week are restricted, standard cron runs the job when EITHER one matches, not both. 0 0 1 * 1 runs on the 1st of every month AND on every Monday. To run only on Mondays that are the 1st, check the date inside your script.
Does this support seconds or Quartz expressions like 0 0 12 ? * MON?
Choose Standard for five-field crontab schedules, Seconds for six fields starting with seconds, or Quartz for six/seven fields with ? and an optional year. Quartz uses 1=Sunday through 7=Saturday, unlike standard cron. Supported calendar modifiers are L, LW, nW, dL and d#n; L offsets are rejected. Runtime-specific scheduler behavior still needs verification.