Developer Tools

Cron Expression Guide — Examples & Generator 2026

7 min read

Master cron expressions with 20 ready-to-use examples. Covers cron syntax fields, special characters, timezone handling, and testing without a server.

Executive Summary

"Cron expressions consist of 5 fields (minute, hour, day-of-month, month, day-of-week). Mastering the syntax allows you to schedule scripts, database backups, and Kubernetes jobs. Use standard `* * * * *` for basic tasks, and avoid non-standard 6-field formats unless explicitly supported by your runtime."

Up-to-date Feed

View All
SEO Tools

Canonical URL SEO Guide — Fix Duplicate Content 2026

Read Now
Developer Tools

Cron Expression Guide — Examples & Generator 2026

Read Now
Developer Tools

DNS Propagation — How Long It Takes & How to Check

Read Now
Developer Tools

Docker Compose Generator — Scaffold Files Fast 2026

Read Now
SEO Tools

FAQ Schema Markup Tutorial — Google Rich Results 2026

Read Now
Developer Tools

Gzip vs Brotli Compression — Web Performance Guide 2026

Read Now
Developer Tools

Kubernetes YAML Validator — Guide for 2026

Read Now
Developer Tools

Nginx Config Generator — Reverse Proxy Guide 2026

Read Now
Security Tools

SSL Certificate Expired — How to Check and Fix 2026

Read Now
SEO Tools

XML Sitemap Best Practices — Complete 2026 Guide

Read Now
SEO Tools

Add Schema Markup Without a Plugin — 2026 Tutorial

Read Now
Security

AES Encryption in the Browser — JavaScript 2026

Read Now
Security

Bcrypt vs Argon2 Password Hashing — 2026 Guide

Read Now
Security

Content Security Policy Generator — 2026 Tutorial

Read Now
Engineering

CSS Box Shadow Generator — 20 Examples for 2026

Read Now
Engineering

CSS Gradient Generator — 15 Modern Examples for 2026

Read Now
Engineering

PX to REM Conversion Guide — CSS Accessibility 2026

Read Now
SEO Tools

Robots.txt Complete Guide — Block AI Crawlers in 2026

Read Now
Security

SQL Injection Testing for Beginners — 2026 Guide

Read Now
Engineering

WCAG Color Contrast Requirements — 2026 Guide

Read Now
Tools

JSON Formatter vs jq: Which Should You Use in 2026?

Read Now
Security

Calculate Password Entropy Bits — Complete Guide

Read Now
Developer Tools

CSV to JSON With Nested Objects — 2026 Guide

Read Now
Developer Tools

Decode JWT Tokens Without a Library — 2026 Guide

Read Now
Developer Tools

Generate JWT Tokens Free — Offline Tool Guide

Read Now
Developer Tools

JSON to Pydantic Model Generator — Python 2026

Read Now
Developer Tools

JSON to TypeScript Interface — Free Converter Guide

Read Now
Developer Tools

JSON to YAML Converter — Free Offline Tool 2026

Read Now
Developer Tools

JWT Token Expiry Error Fix — Node.js 2026

Read Now
Engineering

JWT vs Session Cookies 2026 — Which to Use?

Read Now

✓ Last tested: June 2026 · Verified against standard Vixie Cron implementation

1. Field Notes: The Timezone Trap

Early in my career, I deployed a database backup script using a cron job set to 0 2 * * * (2:00 AM daily). I wanted the backup to happen during the lowest traffic window for our US-based users.

A week later, the database crashed at 9:00 PM EST due to IO exhaustion. Why? The AWS EC2 instance was running in UTC. 2:00 AM UTC is 9:00 PM EST—smack in the middle of prime time.

The lesson? A cron expression is just a string of characters. It has no concept of geography. You must always align your cron schedules to the server's local timezone configuration, which in 2026 should always be UTC.


2. Cron Expression Syntax — The 5 Fields Explained

A standard cron expression consists of five fields separated by spaces. (Some systems, like AWS CloudWatch or Quartz, use 6 fields to include seconds or years, but standard Linux cron uses 5).

* * * * *
│ │ │ │ │
│ │ │ │ └── Day of the week (0 - 7) (0 and 7 are both Sunday)
│ │ │ └──── Month (1 - 12)
│ │ └────── Day of the month (1 - 31)
│ └──────── Hour (0 - 23)
└────────── Minute (0 - 59)

Special Characters

  • * (Asterisk): Matches all values. (e.g., * in the hour field means "every hour").
  • , (Comma): Separates items in a list. (e.g., 1,15 in the minute field means "at minute 1 and 15").
  • - (Hyphen): Defines a range. (e.g., 9-17 in the hour field means "between 9 AM and 5 PM").
  • / (Slash): Specifies increments. (e.g., */10 in the minute field means "every 10 minutes").

3. 20 Ready-to-Use Cron Expression Examples

Stop guessing. Here are the most common schedules you will actually use in production.

High Frequency

  • Every minute: * * * * *
  • Every 5 minutes: */5 * * * *
  • Every 15 minutes: */15 * * * *
  • Every 30 minutes: */30 * * * *

Hourly Schedules

  • Every hour, on the hour: 0 * * * *
  • Every 2 hours: 0 */2 * * *
  • At minute 15 past every hour: 15 * * * *

Daily Schedules

  • Midnight every day: 0 0 * * *
  • Every day at 2:30 AM: 30 2 * * *
  • Every day at 8:00 AM and 8:00 PM: 0 8,20 * * *

Weekly Schedules

  • Every Sunday at midnight: 0 0 * * 0
  • Every Monday at 9:00 AM: 0 9 * * 1
  • Monday through Friday at 5:00 PM (Business close): 0 17 * * 1-5
  • Weekends only, at noon: 0 12 * * 0,6

Monthly / Yearly Schedules

  • First day of every month at midnight: 0 0 1 * *
  • 15th of every month at 3:00 AM: 0 3 15 * *
  • January 1st at midnight (Happy New Year): 0 0 1 1 *

4. Cron in Kubernetes — What's Different?

If you are writing a Kubernetes CronJob manifest, the syntax is identical to standard Linux cron. However, Kubernetes adds a crucial behavior parameter: concurrencyPolicy.

If your job takes 10 minutes to run, but your cron is scheduled every 5 minutes (*/5 * * * *), Kubernetes will overlap the pods. You must set concurrencyPolicy: Forbid in your YAML if your script cannot handle concurrent executions safely.


5. Common Cron Expression Mistakes

  1. The Day/Date OR Trap: If you write 0 0 1 * 1, you might think this means "Run at midnight on the first of the month, BUT ONLY if it's a Monday." Wrong. It means "Run on the first of the month, OR if it is a Monday."
  2. Using Seconds: Writing 0 * * * * * (6 fields) will crash standard crontab, as it expects 5 fields.
  3. Environment Variables: Scripts run by cron execute in a highly restricted shell. Your ~/.bashrc is not loaded. Always use absolute paths to node/python binaries inside your scripts.

Need to translate a complex schedule into cron syntax? Use our free Cron Expression Generator to build and validate your schedule instantly →


External Sources


Abu Sufyan · Full-stack developer · Founder of WebToolkit Pro Github

Last updated: June 2026

Expert Recommendations

Pro Insights

  • 01.Always check the timezone of your server (often UTC). A cron set for `0 9 * * *` (9 AM) will trigger at 4 AM EST if the server is in UTC.
  • 02.If you need a task to run exactly every 30 days, do not use `*/30`. Use day-of-month logic, or handle state within the script itself.
  • 03.Be extremely careful with the Day-of-Month and Day-of-Week fields. If both are specified, the cron will run if EITHER matches (it acts as an OR, not an AND).

Frequently Asked Questions

Q. What does `*/5 * * * *` mean?

It means the job will run every 5 minutes.

Q. How do I run a cron job every second?

Standard cron expressions only go down to the minute. You cannot run a job every second using standard cron. You would need a custom daemon or loop script.

#Cron#Linux#DevOps#Automation
AS

Abu Sufyan

Lead Systems Architect & Performance Engineer

Abu Sufyan specializes in V8 execution benchmarking, React architecture, and enterprise-grade technical SEO.

Blog & Journal Archive

All Entries →