What Is Cron? The Unix Job Scheduler Explained

Cron is a command-line utility in Unix-like operating systems used to schedule tasks to run automatically at specific intervals. It allows developers and system administrators to automate repetitive actions—known as cron jobs—so they don’t have to trigger scripts manually.

If you are running a server or building a SaaS application, you generally cannot rely on manual inputs to keep your infrastructure healthy. You need a way to execute scripts at precise times, whether that is every minute, every Sunday at midnight, or once a year. Cron is the standard utility for handling that “when.”

How the Cron Daemon Works

At its core, cron is a daemon—a background process that runs continuously on your server. In Linux and Unix systems, this daemon is typically named crond.

The daemon wakes up every single minute to check for tasks. It looks for instructions that match the current time and executes them. If there are no tasks scheduled for that specific minute, it goes back to sleep until the next minute starts.

Because cron is a standard utility, it is available on virtually all Unix-like systems, including Ubuntu, Debian, CentOS, and macOS. This universality makes it the backbone of backend automation across the web.

The Difference Between Cron and Crontab

When people talk about “setting up a cron,” they are often using the term loosely to cover three distinct components. To use the tool effectively, it helps to distinguish between the utility, the file, and the command.

1. The Cron Utility

As mentioned above, this is the system process (the daemon) that executes the tasks. You rarely interact with the daemon directly; it simply runs in the background.

2. The Crontab

To communicate with the cron daemon, we use something called a crontab (short for “cron table”). This is a text file that acts as a configuration list. It contains the schedule and the commands you want to run.

Every user on a system can have their own crontab file. The daemon checks these files to see what needs to be done.

  • Learn more: For a guide on editing and formatting this file, read our article on Crontab.

3. The Cron Job

The actual shell command or script defined inside the crontab is the cron job. This is the payload—the actual work that gets done when the time is right.

Controlling Time with Cron Expressions

The crontab accepts a specific string of characters as a parameter to define the schedule. This string is called a cron expression.

A standard cron expression consists of five fields separated by spaces:

* * * * *

These stars represent, in order:

  1. Minute (0-59)
  2. Hour (0-23)
  3. Day of Month (1-31)
  4. Month (1-12)
  5. Day of Week (0-6)

By replacing these asterisks with numbers, lists, or special characters, you can define complex schedules like “every 15 minutes” or “at 3:00 AM only on Mondays.”

  • Learn more: The syntax can be tricky to memorize. We break down exactly how to format these strings in our guide on Cron Expressions.

Real World Use Cases

While cron is technically just a scheduler, its application in software development is massive. It transforms static code into a living application that performs maintenance and data handling without human intervention.

Here are a few specific ways cron is used in production environments:

Read more: Sending newsletters at scheduled times

Running Healthchecks: Developers often schedule scripts to ping their own services or databases to ensure they are online and responsive. If a service is down, the script can trigger a restart sequence.

Read more: Running healthchecks

Generating Reports: SaaS platforms often need to compile daily or weekly usage summaries for their users. Cron triggers these heavy data-processing scripts during low-traffic hours (like 2 AM) to avoid slowing down the system.

Read more: Generating reports

Pulling and Importing Data: If your application relies on third-party APIs, you likely need to sync data regularly. Cron jobs are used to fetch updates from external sources and update your local database.

Read more: Pulling data

Sending Scheduled Newsletters: Marketing automation relies heavily on timing. Cron handles the queue processing to ensure emails are dispatched at the exact time they were scheduled for.

Monitor now. For free.