1. Confirm the job is installed where you think it is

Run crontab -l as the same user that owns the job. A line added to /etc/crontab has an extra user column, while a user crontab does not; mixing the two formats is a common reason a line is ignored. If the job was added inside a container, confirm the image actually runs a cron daemon — many slim images ship without one.

shell
# user crontab: 5 fields + command
crontab -l

# system crontab: 5 fields + user + command
cat /etc/crontab

# is the daemon alive?
systemctl status cron    # Debian/Ubuntu
systemctl status crond   # RHEL/Alpine

2. Check the daemon, not just the file

Editing a file does not schedule anything. The daemon must be running and must reload the crontab. crontab -e reloads automatically; copying a file into /etc/cron.d may require a restart depending on the implementation. In containers, a foreground process sometimes replaces the entrypoint, and cron never starts at all.

  • systemctl is-active cron should print active, not inactive or failed.
  • In Docker, ps aux | grep cron should show a running daemon; if not, start it in the entrypoint.
  • Look at /var/log/syslog or journalctl -u cron for “(CRON) error” lines, which often name the exact problem.

3. Reproduce the environment cron uses

Cron starts jobs with a minimal environment: a short PATH, no shell profile, no .bashrc, no exported variables from your terminal. A command that works in your shell can fail instantly under cron because node, python, npx or a virtualenv is not on the path. Use absolute binary paths, and set PATH and any required variables at the top of the crontab.

crontab
SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
[email protected]

0 9 * * 1-5  cd /srv/app && /usr/bin/python3 report.py >> /var/log/report.log 2>&1

Test with env -i /bin/sh -c 'your command' to approximate the empty environment cron provides.

4. Compare timezones before blaming the schedule

Cron interprets the expression in the daemon's timezone, usually UTC on servers. If you built “9 AM” while thinking in local time, the job fires at the wrong hour and looks broken. Run date and timedatectl on the host, compare with the next-run preview here using the same timezone, and set CRON_TZ if your cron implementation supports it.

  • timedatectl shows both the system time and the timezone name.
  • Containers inherit the host clock but usually default to UTC inside the image.
  • A job scheduled at 02:30 can be skipped entirely on the day clocks spring forward.

5. Stop losing output and exit codes

By default cron mails output to the local user, which often goes nowhere. Redirect stdout and stderr to a file, and log the exit code so a failing command is distinguishable from a command that never ran. Add a timestamp and hostname to the log line; overlapping runs become obvious.

shell
0 * * * *  /usr/bin/flock -n /tmp/report.lock /usr/bin/python3 /srv/app/report.py >> /var/log/report.log 2>&1; echo "exit=$? $(date -Is)" >> /var/log/report.status

6. Check permissions and overlap

The job runs as the user who owns the crontab, not as root unless installed there. Files written by a previous root run may be unreadable, and lock files may be left behind after a crash. Long-running jobs also overlap: a job that takes 70 minutes on an hourly schedule will eventually collide with itself. Use flock or a scheduler with concurrency control.

If you have checked all six and the job still does not run, replace it with * * * * * date >> /tmp/cron-test.log. If that line produces nothing, the problem is the daemon, not your command.

When to move off cron

Cron is fine for single-host, idempotent tasks. It is the wrong tool for retries, dependencies, distributed execution, or observability. systemd timers give you logging, Persistent=true for missed runs and explicit dependencies without installing anything else.

ini
# /etc/systemd/system/report.service
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /srv/app/report.py

# /etc/systemd/system/report.timer
[Timer]
OnCalendar=Mon-Fri 09:00
Persistent=true
[Install]
WantedBy=timers.target