Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … Cron job not running

Cron job not running: the usual reasons

The job never starts, or starts and fails silently because cron's environment differs from your shell.

Linux

What it means

Cron runs commands with a minimal environment: a short PATH, no profile, a different working directory, and output mailed (or dropped) instead of shown. Most "cron doesn't run" problems are a wrong schedule or the job failing in that environment.

Causes and fixes

Most likely first. Run the check, and if it matches, apply the fix.

1. The schedule is wrong (fields in the wrong order, day-of-week confusion)

Check:

crontab -l

Fix: The order is minute hour day-of-month month day-of-week; 0 2 * * * is 02:00 daily.

2. Commands not found because of cron's PATH, or a relative path

Check:

grep CRON /var/log/syslog | tail; journalctl -u cron | tail

Fix: Use absolute paths or set PATH= at the top of the crontab; cd to the directory first.

3. % in the command (cron treats it as a newline)

Check:

crontab -l | grep %

Fix: Escape it as % (date +%F).

4. Files in /etc/cron.d with the wrong owner, mode, missing user field or a dot in the name

Check:

ls -l /etc/cron.d

Fix: Root-owned, 0644, a user column, and no dots in the file name.

Fix it yourself

A live machine in your browser with this problem already on it. The grader checks the result.

Open the lab

No account needed for your first tries.