DevToolBoxFREE
Blog

Cron Expression Generator & Examples: Every 5 Min, Daily, Weekly, Monthly

8 min readby DevToolBox

Cron expressions are the standard way to schedule recurring tasks on Unix/Linux systems. This guide covers the most common cron patterns with ready-to-use examples.

Cron Syntax Overview

A standard cron expression has 5 fields:

┌───────────── Minute (0-59)
│ ┌─────────── Hour (0-23)
│ │ ┌───────── Day of month (1-31)
│ │ │ ┌─────── Month (1-12)
│ │ │ │ ┌───── Day of week (0-7, where 0 and 7 = Sunday)
│ │ │ │ │
* * * * *  command_to_execute

Quick Reference: Common Cron Expressions

ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/15 * * * *Every 15 minutes
*/30 * * * *Every 30 minutes
0 * * * *Every hour (at minute 0)
0 */2 * * *Every 2 hours
0 */6 * * *Every 6 hours
0 0 * * *Daily at midnight
0 6 * * *Daily at 6:00 AM
30 8 * * *Daily at 8:30 AM
0 0 * * 0Weekly (Sunday midnight)
0 9 * * 1Every Monday at 9:00 AM
0 9 * * 1-5Weekdays at 9:00 AM
0 0 1 * *First of every month (midnight)
0 0 1 1 *January 1st (midnight)
0 0 1 */3 *Every 3 months (quarterly)
0 0 * * 1,4Monday and Thursday at midnight
0 8-17 * * 1-5Every hour 8AM-5PM, weekdays

Special Characters Explained

  • ** (asterisk) — Matches every possible value for that field
  • // (slash) — Step value. */5 means "every 5 units"
  • ,, (comma) — List of values. 1,3,5 means "1, 3, and 5"
  • -- (dash) — Range. 1-5 means "1 through 5"

Examples with special characters:

# Every 5 minutes
*/5 * * * *

# At minutes 0, 15, 30, 45 of every hour
0,15,30,45 * * * *

# Every weekday (Monday-Friday) at 9 AM
0 9 * * 1-5

# Every Monday and Friday at 6 PM
0 18 * * 1,5

# Every 3 hours on weekdays
0 */3 * * 1-5

Platform Differences

Standard cron

Standard cron (crontab): 5 fields (minute hour day month weekday)

*/5 * * * * /path/to/script.sh
AWS EventBridge

AWS CloudWatch/EventBridge: 6 fields, adds year; uses "?" for day-of-week or day-of-month

cron(0/5 * * * ? *)
GitHub Actions

GitHub Actions: Standard 5 fields in schedule.cron, uses UTC

schedule:
  - cron: '*/5 * * * *'
Kubernetes

Kubernetes CronJob: Standard 5 fields

spec:
  schedule: "*/5 * * * *"

Common Mistakes to Avoid

  • Forgetting timezone — Cron runs in the system timezone unless configured otherwise. CI/CD platforms often use UTC.
  • Using * * * * * (every minute) — This runs 1,440 times per day. Make sure you mean it!
  • Confusing day-of-week values — Sunday is 0 (or 7) in standard cron, but 1 in some systems.
  • Not logging output — Redirect stdout/stderr: */5 * * * * /script.sh >> /var/log/cron.log 2>&1
  • Overlapping runs — If a job takes longer than the interval, use flock or a lock file.

Test your cron expressions interactively

Cron Expression Parser →

FAQ

How do I schedule a cron job every 5 minutes?

Use */5 * * * * — the */5 in the minute field means "every 5th minute".

What does 0 0 * * * mean?

It runs at midnight (00:00) every day. The first 0 is the minute, the second 0 is the hour.

How do I run a cron job every Monday at 9am?

Use 0 9 * * 1 — minute=0, hour=9, any day, any month, weekday=1 (Monday).

What is the difference between */5 and 0/5?

In standard cron they are equivalent — both mean "every 5th minute". Some platforms like AWS support 0/5 syntax specifically.

Can I specify both day-of-month and day-of-week?

In standard cron, if both are set (not *), the job runs when EITHER matches. AWS CloudWatch requires "?" for one of them.

𝕏 Twitterin LinkedIn
Was this helpful?

Stay Updated

Get weekly dev tips and new tool announcements.

No spam. Unsubscribe anytime.

Try These Related Tools

Cron Expression ParserCron Expression Generator⏲️Crontab Generator🔍Cron Expression Parser

Related Articles

Chmod Calculator & Linux Permissions: chmod 777, 755, 644 Explained

Free online chmod calculator and Linux file permissions guide. Understand octal notation, chmod 777 vs 755 vs 644, and convert between rwx and numeric modes.

Cron Schedule for Serverless: GitHub Actions, Vercel Cron, and Cloudflare Workers

Master cron expressions across serverless platforms. Learn syntax differences, timezone pitfalls, and copy-paste schedule examples.