Last updated
Understanding Cron Syntax
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, 0 and 7 = Sunday)
│ │ │ │ │
* * * * *
Quick Reference
Special characters:
* = every value
, = list of values (1,3,5)
- = range (1-5)
/ = step (*/15 = every 15)
? = no specific value (AWS/Quartz only)
Common expressions:
@yearly = 0 0 1 1 *
@monthly = 0 0 1 * *
@weekly = 0 0 * * 0
@daily = 0 0 * * *
@hourly = 0 * * * *
Use the generator's "Next execution times" preview to verify your expression runs exactly when you expect before deploying it to production.
Examples
Example 1: Common Scheduling Patterns
# Every minute
* * * * *
# Every hour (at minute 0)
0 * * * *
# Every day at midnight
0 0 * * *
# Every day at 2:30 AM
30 2 * * *
# Every Monday at 9:00 AM
0 9 * * 1
# Every weekday (Mon–Fri) at 8:00 AM
0 8 * * 1-5
# Every weekend at noon
0 12 * * 6,0
# First day of every month at midnight
0 0 1 * *
# Every 15 minutes
*/15 * * * *
# Every 6 hours
0 */6 * * *
Example 2: Database Backup Schedule
Run a database backup every night at 2:00 AM, and a weekly full backup on Sunday at 1:00 AM:
# Daily incremental backup at 2:00 AM
0 2 * * *
# Weekly full backup on Sunday at 1:00 AM
0 1 * * 0
# In crontab format:
0 2 * * * /usr/local/bin/backup-incremental.sh
0 1 * * 0 /usr/local/bin/backup-full.sh
Example 3: Business Hours Scheduling
Run a task every 30 minutes during business hours (9 AM to 6 PM), Monday through Friday:
# Every 30 minutes, 9 AM to 6 PM, weekdays only
*/30 9-18 * * 1-5
# Send a daily report at 5:00 PM on weekdays
0 17 * * 1-5
# Run a health check every 5 minutes during business hours
*/5 8-20 * * 1-5