# Cron Jobs and Schedules

> How cron runs a command on a timer, and how to read the five fields of a line like 0 3 * * *. Why a job that works by hand can fail in cron.

**Course:** [Linux Command Line](https://learn.benibix.com/learn/infrastructure-linux)  
**Time:** 11 min

**After this lesson you can:**

- Read a five-field cron line
- Add a job with crontab -e
- Say why cron jobs need full paths

## How to read 0 3 * * *

Cron is a daemon that runs commands on a timer. Each job is one line: five fields that say when, then the command. 0 3 * * * means at minute 0 of hour 3, every day, every month, every day of the week. In other words, every night at 3:00. You edit your list with crontab -e.

The five fields are, in order: minute, hour, day of the month, month, and day of the week. A star means any. A number means only that one. 1-5 in the last field means Monday to Friday. */15 in the first field means every 15 minutes.

So 30 9 * * 1-5 runs at 9:30 on weekdays. 0 0 1 * * runs at midnight on the first of each month. The times follow the server's own clock, and that clock may be set to a time zone that is not yours.

Cron runs the job with a very short PATH, and without the values your login window sets. A command that works when you type it can fail in cron because it cannot find a program. Use full paths in cron lines, such as /usr/bin/python3 rather than python3.

Cron does not show you what happened. Anything the job prints is lost, unless you send it to a file. Add >> /home/emma/backup.log 2>&1 to the end of the line, and every run leaves a record you can read.

A cron line is like a recurring alarm on a phone. Once it is set, it goes off on time whether anyone is watching or not. That is the point, and also the danger.

A common mistake is to forget the server's time zone. Many servers keep world time, which is one or two hours behind Berlin. A job set for 0 3 then runs at 4 or 5 a.m. in Berlin. Check with the date command before you pick the hour.

```console
$ crontab -l
0 3 * * * /home/emma/backup.sh >> /home/emma/backup.log 2>&1
*/15 * * * * /usr/bin/curl -s https://emmas-shop.com/health
```
Two jobs. A backup runs every night at 3:00 and saves what it prints. A check runs every 15 minutes.

![The crontab line 30 9 * * 1-5 /home/jack/report.sh with each part labelled. 30 is the minute, 9 is the hour, the first star is any day of the month, the second star is any month, and 1-5 is Monday to Friday. The path after them is the command to run.](https://learn.benibix.com/diagrams/inf3-cron.svg)

### Example: Lucy's backup never ran

Lucy adds 0 2 * * * backup.sh to her crontab. The script works when she types it, but a week later there are no backups.

The line had no full path, so cron could not find the script. She changes it to /home/lucy/backup.sh and saves its output to a log. The next morning the log shows a clean run.

**Words in this lesson:** [Cron](https://learn.benibix.com/term/infrastructure/cron), [Cron Expression](https://learn.benibix.com/term/infrastructure/cron-expression)

**Question:** When does the cron line 30 9 * * 1-5 run?

**Answer:** At 9:30 on weekdays. The fields are minute, hour, day of the month, month and day of the week. 30 and 9 make 9:30, and 1-5 in the last field is Monday to Friday.

---

Source: https://learn.benibix.com/learn/infrastructure-linux/cron-jobs-and-schedules
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
