Sistava

What is Cron?

Also called cron expression, crontab.

Cron is a time based scheduler originating in Unix, and by extension the expression syntax used to describe recurring schedules. A cron expression uses five or six fields covering minute, hour, day of month, month, day of week, and sometimes seconds. The syntax has become the common vocabulary for recurring schedules well beyond the original program.

The classic expression has five fields separated by spaces. Each accepts a specific value, a wildcard meaning every value, a list, a range, or a step. Reading right to left, the fields are day of week, month, day of month, hour, and minute. Many modern schedulers extend the format with a leading seconds field or trailing year field, which is a frequent source of copy and paste errors between systems.

One rule surprises almost everyone. When both day of month and day of week are restricted, standard cron treats them as an OR rather than an AND, so the job runs when either matches. An expression intended to mean the first of the month only when it falls on a Monday instead fires on every first and every Monday. Some implementations deviate from this behavior, so the target scheduler's documentation is the authority.

Cron expressions say nothing about semantics beyond timing. They do not express what happens when a run overlaps the next trigger, what happens to triggers missed during downtime, which time zone applies, or whether concurrent runs are permitted. Those behaviors belong to the scheduler, and two systems given the same expression can behave quite differently.

The classic Unix daemon also has operational limitations that matter at scale. It runs on a single machine with no built in redundancy, provides minimal logging, and reports failures only through local mail by default. Production systems generally use a distributed scheduler that offers durable trigger history, retries, and alerting, while keeping cron syntax as the familiar way to express the timing.

Key points

In practice

The expression 0 6 * * 1 means at minute zero of hour six on Monday, so a job runs weekly at 06:00. Changing it to 0 6 * * * makes it daily at the same hour. Writing 0 6 1 * 1 does not mean the first of the month when it is a Monday. Because the day fields combine as OR, it fires on the first of every month and on every Monday.

Related terms

Back to the AI Glossary