The job works when you run it by hand and does nothing from cron. That sentence covers most cron debugging. The usual cause is not the schedule; it is that cron runs your command with a different environment, a different working directory and a different shell.

Work through this list in order.

1. Is the daemon running?

systemctl status cron        # Debian/Ubuntu
systemctl status crond       # RHEL family

If the service is stopped or failed, no expression matters. Check journalctl -u cron for startup errors.

2. Did you edit the right crontab?

  • crontab -e edits the current user's crontab.
  • /etc/crontab is a system file with an extra user field before the command.
  • /etc/cron.d/* files also carry the user field.
  • Container images may not run a cron daemon at all.

A line pasted from a blog post into /etc/crontab without the user column will be parsed as a malformed schedule.

3. Is the syntax actually valid?

Five fields, then the command. A missing field shifts everything. Use a parser rather than eyeballing it; the cron explainer reports field count and invalid ranges.

4. Is it the day-of-month OR rule?

0 0 1 * 1 runs on the first of the month or every Monday. If you expected “first of the month only when it is a Monday”, the job will appear to run at the wrong times, not never.

5. PATH is not your PATH

Cron typically starts with PATH=/usr/bin:/bin. A command installed in /usr/local/bin or a version manager shim will not be found. Use an absolute path:

0 2 * * * /usr/local/bin/backup.sh

Inside the script, set the PATH explicitly:

#!/usr/bin/env bash
PATH=/usr/local/bin:/usr/bin:/bin

6. The shell is /bin/sh

Cron uses /bin/sh by default, which may be dash, not bash. Bashisms such as [[ ]], arrays and source fail. Add SHELL=/bin/bash at the top of the crontab, or keep the script POSIX-compatible and invoke it directly.

7. Working directory is not what you think

Cron starts in the user's home directory. A relative path like ./data.csv points somewhere else. Use absolute paths or cd at the start of the script.

8. Percent signs are special

In a crontab, an unescaped % ends the command and sends the rest as stdin. A date +%Y-%m-%d inside a cron line silently truncates. Escape every percent sign as \%, or put the logic inside a script.

9. Permissions and ownership

The script must be executable by the cron user. A root-owned script with mode 700 will fail for a non-root crontab. Check with:

sudo -u www-data /path/to/script.sh

Running as the same user is more informative than running as yourself.

10. Output went to mail, and nobody read it

Cron mails stdout and stderr. If mail is not configured, output may be dropped or bounce. Redirect it to a log you control:

0 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

Then read the log. A job that runs and fails looks identical to a job that never ran if you only check the destination.

11. The job is running but overlapping

A job that takes longer than its interval accumulates processes. Use flock to prevent overlap:

*/5 * * * * flock -n /tmp/report.lock /usr/local/bin/report.sh

-n exits immediately if the lock is held. Without it, the second copy waits and the backlog grows.

12. Something else is blocking it

  • SELinux or AppArmor denying execution.
  • A missing environment variable that the script expects.
  • A network call blocked by a proxy or firewall.
  • A timezone mismatch making the schedule fire at an unexpected hour.
  • The scheduler is a systemd timer, not cron, and the crontab is irrelevant.

A fast isolation procedure

  1. Replace the command with * * * * * date >> /tmp/cron-test.log 2>&1.
  2. Wait two minutes. If the file appears, the daemon and syntax are fine.
  3. Replace date with your script, keeping the redirect.
  4. Run the script manually as the cron user with env -i to approximate cron's environment.
  5. Compare the two outputs.

Most problems surface at step 4: a missing PATH entry, a relative path, or a variable that exists only in your interactive shell.

Cron is not magic and it is not hostile. It is a minimal environment. Once you stop assuming your shell, your paths and your timezone, the job usually starts working.