Cron Expression Explainer

Understand any cron schedule in plain English

Minute
0-59
Hour
0-23
Day of Month
1-31
Month
1-12
Day of Week
0-6

Common Examples

Cron Syntax Reference

Special Characters

* - any value
, - value list separator
- - range of values
/ - step values

Field Ranges

Minute: 0-59
Hour: 0-23
Day of Month: 1-31
Month: 1-12
Day of Week: 0-6 (Sun-Sat)
100% Client-Side Analysis

This tool runs 100% in your browser. No data is sent to any server.

What is Cron?

Cron is a time-based job scheduler built into Unix-like operating systems including Linux, macOS, and BSD. It allows you to schedule commands or scripts to run automatically at fixed times, dates, or intervals — without any manual intervention.

System administrators and developers use cron for a wide range of recurring tasks: database backups, log rotation, cache clearing, sending scheduled emails, renewing SSL certificates, pulling updates from a Git repository, and running health checks on services. On a web hosting server like those at NetOz, cron jobs are essential for keeping websites running smoothly behind the scenes.

Each user on a system has their own crontab (cron table) — a file that lists all their scheduled jobs. You can edit it with crontab -e and view it with crontab -l. System-wide cron jobs are typically placed in /etc/crontab or the /etc/cron.d/ directory.

Cron Syntax Explained

A standard cron expression consists of five fields separated by spaces, each representing a unit of time. The fields are evaluated together to determine when the job should run:

*****command
minhrdommondow
  • Minute (0–59) — The minute of the hour when the job runs
  • Hour (0–23) — The hour of the day (24-hour format)
  • Day of Month (1–31) — The day of the month
  • Month (1–12) — The month of the year (or JAN–DEC)
  • Day of Week (0–7) — The day of the week (0 and 7 are both Sunday, or SUN–SAT)

Special Characters

  • * — Any value (wildcard). * * * * * means every minute of every day.
  • , — List separator. 1,15 means at 1 and 15.
  • - — Range. 1-5 means 1 through 5.
  • / — Step value. */15 means every 15 units.

Common Cron Examples

* * * * *
Every minute
*/5 * * * *
Every 5 minutes
0 * * * *
Every hour (at minute 0)
0 0 * * *
Every day at midnight
0 2 * * *
Every day at 2:00 AM (common for backups)
30 4 1 * *
First day of every month at 4:30 AM
0 9-17 * * 1-5
Every hour during business hours (Mon–Fri)
0 0 * * 0
Every Sunday at midnight
*/30 * * * *
Every 30 minutes
0 6,18 * * *
At 6:00 AM and 6:00 PM every day
0 0 1,15 * *
1st and 15th of every month at midnight
0 3 * * 6
Every Saturday at 3:00 AM

Real-World Server Examples

Here are some practical cron jobs you might find on a web hosting server:

0 2 * * * mysqldump -u root mydb > /backups/db-$(date +\%F).sql
Database backup every night at 2 AM
*/5 * * * * curl -s https://netoz.au/health > /dev/null
Health check every 5 minutes
0 0 1 * * certbot renew --quiet
SSL certificate renewal check on the 1st of each month

Crontab Cheat Sheet

Shorthand Strings

Most cron implementations support convenient shorthand strings that replace the five-field syntax:

@yearly0 0 1 1 *
@monthly0 0 1 * *
@weekly0 0 * * 0
@daily0 0 * * *
@hourly0 * * * *
@rebootRun once at startup

Useful Commands

  • crontab -l — List all cron jobs for the current user
  • crontab -e — Edit the current user's crontab
  • crontab -r — Remove the current user's crontab (use with caution)
  • sudo crontab -u www-data -l — List cron jobs for a specific user

Common Pitfalls

  • Environment variables: Cron runs with a minimal environment. Commands that work in your shell may fail in cron because PATH is different. Always use full paths to commands (e.g. /usr/bin/php instead of just php).
  • Output handling: By default, cron emails the output of every job to the user. Redirect output to a log file or /dev/null to avoid filling up mailboxes: >> /var/log/myjob.log 2>&1
  • Timezone: Cron uses the system timezone by default. On servers configured in UTC (common for hosting), a midnight cron job runs at UTC midnight, not local Adelaide time (ACST/ACDT). Set the CRON_TZ variable or adjust times accordingly.
  • Percent signs: The % character has special meaning in crontab and must be escaped with a backslash (\%). This commonly causes issues with date +%F commands.

Use this cron explainer to verify your expressions before adding them to your crontab. For server management, also check out our Systemd Unit Generator for creating service files, or our Web Server Config Generator for Nginx and Apache configurations.