Free Server Automation & DevOps Tool
Cron Expression Generator
Build, test, and understand standard Unix/Linux cron expressions visually. Generate crontab schedules for automated server maintenance, database backups, API polling, and email reports with real-time plain English translation.
Quick Presets
0–59
0–23
1–31
1–12
0–6
Expression
0 9 * * *Meaning
At 09:00
Next 5 Runs
- 10/15/2026, 9:00:00 AM
- 10/16/2026, 9:00:00 AM
- 10/17/2026, 9:00:00 AM
- 10/18/2026, 9:00:00 AM
- 10/19/2026, 9:00:00 AM
What is a Cron Job and How Does Crond Work?
In Unix-like operating systems (including Linux, macOS, and BSD), cron is a time-based job scheduling daemon that runs continuously in the background. Named after the Greek word for time (Chronos), cron allows developers, DevOps engineers, and system administrators to automate repetitive system administration tasks, background data pipelines, security scans, SSL certificate renewals, and database backup routines without manual human intervention.
The underlying daemon—typically named crond or cron—sleeps continuously and wakes up at the beginning of every single minute. Upon waking, it reads the crontab configuration tables stored on the filesystem (such as /var/spool/cron/ and /etc/cron.d/). If the current system time matches the pattern defined in an entry, the daemon forks a new shell sub-process to execute the command.
Why Visual Cron Generators Prevent Critical Production Outages
While the 5-field cron syntax is elegant and compact, it is notoriously prone to human syntax errors. Minor mistakes—such as writing * 2 * * * (which executes every single minute between 2:00 AM and 2:59 AM) instead of 0 2 * * * (which executes exactly once at 2:00 AM)—have brought down major production databases by spamming heavy backup scripts 60 times in an hour. Using a visual builder ensures your syntax matches your exact timing intent.
Understanding the 5-Field Standard Crontab Syntax
A standard Unix cron expression consists of exactly five space-separated fields, followed by the shell command or script to execute:
Standard 5-Field Structure
│
Min
│
Hour
│
DoM
│
Month
│
DoW
| Field Position | Field Name | Allowed Values | Allowed Special Characters | Description |
|---|---|---|---|---|
| 1 | Minute | 0 – 59 | * , - / | Specific minute of the hour. |
| 2 | Hour | 0 – 23 | * , - / | Hour of the day in 24-hour military time (0 = Midnight). |
| 3 | Day of Month | 1 – 31 | * , - / | Calendar day of the current month. |
| 4 | Month | 1 – 12 (or JAN – DEC) | * , - / | Calendar month of the year. |
| 5 | Day of Week | 0 – 7 (or SUN – SAT) | * , - / | Day of week where both 0 and 7 represent Sunday. |
Special Operators & Wildcard Symbols
Matches every possible number in that field. E.g. * in hour means every hour.
Specifies an explicit list of values. E.g. 1,15,30 in minute runs at minutes 1, 15, and 30.
Specifies an inclusive range. E.g. 1-5 in day-of-week runs Monday through Friday.
Specifies step increments. E.g. */10 in minute runs every 10 minutes (0, 10, 20, 30, 40, 50).
Practical Crontab Examples for Common DevOps Scenarios
Below is a curated reference table of frequently used cron expressions for server management, microservice health checks, and scheduled batch processing:
| Cron Expression | Human Translation | Common Real-World Use Case |
|---|---|---|
| * * * * * | Every minute | Queue workers, heartbeat monitors, fast message processing |
| */5 * * * * | Every 5 minutes | API endpoint polling, metrics scraping, cache warming |
| */15 * * * * | Every 15 minutes | Syncing third-party inventory, checking email inboxes |
| 0 * * * * | Every hour at minute 0 | Hourly data rollup, temp file cleanup, log rotation |
| 0 0 * * * | Daily at midnight (00:00) | Nightly database backups, database index maintenance |
| 30 2 * * * | Daily at 02:30 AM | Off-peak system updates, heavy reporting queries |
| 0 9 * * 1-5 | Weekdays (Mon-Fri) at 09:00 AM | Daily morning Slack reminders, business day digest emails |
| 0 0 * * 0 | Weekly on Sunday at midnight | Weekly customer invoices, deep log archiving to S3 |
| 0 0 1 * * | First day of every month at 00:00 | Monthly billing charges, subscription renewals, quota resets |
| 0 0 1 1 * | Annually on January 1st at midnight | Yearly financial reconciliations, tax compliance archives |
Crontab Special Macros vs. Modern Systemd Timers
Modern Unix distributions support non-standard string shortcuts (macros) that replace the 5-field syntax with human-readable aliases:
Runs exactly once when the server boots or reboots.
Equivalent to 0 0 1 1 * (Runs once a year on Jan 1st).
Equivalent to 0 0 1 * * (Runs once a month on the 1st).
Equivalent to 0 0 * * 0 (Runs every Sunday at midnight).
Migrating from Cron to Systemd Timers
On modern Linux systems (Ubuntu, Debian, RHEL, CentOS), systemd timers are increasingly favored over legacy crontab because they offer integrated logging via journalctl, dependency management, execution failure alerts, and microsecond-level accuracy.
# /etc/systemd/system/backup.timer
[Unit]
Description=Run nightly database backup
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
[Install]
WantedBy=timers.target
Top 6 Production Cron Pitfalls & How to Prevent Them
Automating scripts via cron is simple, but subtle runtime quirks can lead to silent failures in production environments:
1. The Minimal PATH Environment Trap
When you run a command interactively in terminal, your .bashrc or .zshrc loads your full PATH. Cron runs with a barebones PATH (/usr/bin:/bin). Always supply full absolute paths to binaries (e.g. /usr/bin/python3 or /usr/local/bin/docker).
2. Overlapping Jobs & Process Pileups (Flock Locking)
If a job runs every 5 minutes but occasionally takes 12 minutes to process a large payload, cron will spawn a second instance on top of the first, causing memory exhaustion and database lock contention. Prevent overlapping with flock:*/5 * * * * /usr/bin/flock -n /tmp/myjob.lock /home/user/heavy_sync.sh
3. Output Redirection & Log Management
Unredirected cron jobs fill up /var/mail/ or spam sendmail. Always redirect stdout and stderr to a log file with rotation:0 3 * * * /home/user/backup.sh >> /var/log/backup.log 2>&1
4. The Escaped Percent Sign (%) Gotcha
In crontab files, unescaped percent signs (%) are translated into newlines by the shell unless escaped with a backslash (\%). If you write date +%Y-%m-%d, your job will crash. Always write date +\%Y-\%m-\%d in crontab entries.
Frequently Asked Questions About Cron & Crontab
Expert answers regarding cron syntax rules, troubleshooting failed background jobs, and best practices.