Saved

Utilix knowledge base

What Is Cron? A Guide to Cron Scheduling

Published Apr 17, 2026

What Is Cron?

Cron is a time-based job scheduler in Unix-like operating systems. It runs commands or scripts automatically at specified intervals — daily backups, hourly data syncs, weekly reports, and more.

The name comes from Chronos, the Greek personification of time. Scheduled tasks are called cron jobs, and the schedule is defined in a crontab (cron table) file.

Cron Expression Format

A cron expression has five fields (or six if seconds are supported):

┌───────────── minute (0–59)
│ ┌─────────── hour (0–23)
│ │ ┌───────── day of month (1–31)
│ │ │ ┌─────── month (1–12)
│ │ │ │ ┌───── day of week (0–7, where 0 and 7 are Sunday)
│ │ │ │ │
* * * * *  command

Special Characters

CharacterMeaningExample
*Every value* * * * * — every minute
,List of values0,30 * * * * — at 0 and 30 minutes past
-Range0 9-17 * * * — every hour between 9am and 5pm
/Step*/15 * * * * — every 15 minutes
@rebootSpecial stringRun once on system startup

Common Cron Examples

ExpressionMeaning
* * * * *Every minute
0 * * * *Every hour (at :00)
0 0 * * *Every day at midnight
0 9 * * 1-5Every weekday at 9am
0 9 * * 1Every Monday at 9am
*/15 * * * *Every 15 minutes
0 0 1 * *First day of each month at midnight
0 0 * * 0Every Sunday at midnight
30 7 * * 1-5Weekdays at 7:30am
0 2 * * *Every day at 2am

Special Strings (Shorthand)

Many cron implementations accept shorthand strings:

ShorthandEquivalentMeaning
@yearly0 0 1 1 *Once a year, 1 Jan
@monthly0 0 1 * *Once a month, 1st day
@weekly0 0 * * 0Once a week, Sunday midnight
@daily0 0 * * *Once a day, midnight
@hourly0 * * * *Once an hour
@rebootOnce at startup

Editing Crontab

crontab -e   # Edit current user's crontab
crontab -l   # List current crontab entries
crontab -r   # Remove the crontab (irreversible — be careful)

Example entry:

30 2 * * * /usr/bin/python3 /home/user/backup.py >> /var/log/backup.log 2>&1

This runs backup.py at 2:30am every day, appending stdout and stderr to a log file.

Common Pitfalls

  • Timezone: Cron uses the system timezone unless you set CRON_TZ or TZ= in the crontab header. Servers are often in UTC.
  • Environment variables: Cron runs with a minimal environment — PATH is usually just /usr/bin:/bin. Use full paths.
  • No output by default: If cron output isn't redirected, it emails the local user. Redirect to a file or /dev/null.
  • Day of week and day of month: If both are set (not *), cron runs if either condition is met, not both.

Use the Cron Expression Explainer to convert any cron expression into plain English.