# Your Cron Job Isn't Running?

It works when you run it yourself, and cron quietly never does. Here's how to find out why.

Guide by Jon C. Phillips · November 11, 2026 · https://joncphillips.com/why-your-cron-job-isnt-running/

When a cron job fails, it usually says nothing at all. This is the list to work through, roughly in the order worth checking.

## First, Find Out If It Ran at All

Before guessing, check whether cron even tried. On Debian and Ubuntu, cron's log lines go to `/var/log/syslog` if rsyslog is installed. Debian stopped installing rsyslog by default in version 12, so on a newer Debian box they're only in the journal:

```bash
grep CRON /var/log/syslog | tail -20
# or, on systems without /var/log/syslog
journalctl -u cron --since "1 hour ago"
```

On Fedora and RHEL-style systems the service is `crond`, so use `journalctl -u crond`, or look in `/var/log/cron`.

You'll see one line per job cron started, with the user and the command. If your job is in there, cron did its part and the problem is in the command itself. If it's missing, the problem is somewhere before the command, in the schedule or the crontab.

## 1. Cron Isn't Running

It sounds too obvious, but on containers and fresh servers it happens:

```bash
systemctl status cron    # Debian, Ubuntu
systemctl status crond   # Fedora, RHEL, Rocky, Alma
```

If it's inactive, start it and enable it so it comes back after a reboot. Docker containers almost never run cron unless you set that up on purpose.

## 2. The Schedule Isn't What You Think

A schedule can be perfectly valid and still never match the time you expect. A common mistake is a 12-hour habit in a 24-hour field, where `2` means 2am. Restricting both day fields is another, since cron then runs the job when either one matches.

Paste the expression into the [Cron Expression Generator](https://joncphillips.com/tools/cron-expression-generator/) and look at the next few run times. If they're not what you meant, you've found it. My [crontab syntax guide](https://joncphillips.com/crontab-syntax-explained-with-examples/) goes through every field if you want the full picture.

## 3. It Can't Find Your Commands

This is the most common cause. Cron runs jobs with a tiny environment, and its `PATH` is usually just `/usr/bin:/bin`. Anything in `/usr/local/bin` isn't on it, and neither is anything installed through a version manager like nvm or pyenv.

So `node build.js` works in your terminal and fails in cron with "command not found", which you'll never see unless you capture the output.

Use the full path in the crontab line (`/usr/local/bin/node`, which you can find with `which node`), or set `PATH` at the top of the crontab:

```bash
PATH=/usr/local/bin:/usr/bin:/bin
```

## 4. Your Shell Setup Isn't Loaded

Cron doesn't read your shell's startup files like `.bashrc` or `.zshrc`. Any environment variables you set there, like API keys or `NODE_ENV`, don't exist when the job runs.

The cleanest fix is to put what the script needs in the script itself, or in a file the script loads explicitly:

```bash
#!/usr/bin/env bash
set -a
source /home/deploy/app/.env
set +a
exec /usr/local/bin/node /home/deploy/app/build.js
```

A quick way to see what your job is up against is to run it with the same bare environment cron gives it. Set `PATH` by hand here, because with no `PATH` at all the shell falls back to its own default, and that usually includes `/usr/local/bin`, which hides the most common problem:

```bash
cd ~ && env -i HOME="$HOME" LOGNAME="$USER" SHELL=/bin/sh PATH=/usr/bin:/bin /bin/sh -c '/path/to/your/script.sh'
```

If it fails there, it'll fail in cron.

## 5. It's Running From the Wrong Directory

Cron starts jobs in the user's home directory. A script that reads `./config.json` or writes to `logs/` works when you run it from the project folder and breaks in cron.

Either use absolute paths everywhere, or `cd` first:

```bash
0 2 * * *  cd /home/deploy/app && ./backup.sh
```

## 6. The Script Isn't Executable, or Has No Shebang

If the crontab calls the script directly (`/home/deploy/backup.sh`), it needs execute permission and a shebang line telling the system what runs it:

```bash
chmod +x /home/deploy/backup.sh
head -1 /home/deploy/backup.sh   # should be something like #!/usr/bin/env bash
```

Files edited on Windows can also carry `\r` line endings, which turns the shebang into `/bin/bash\r` and gives you a confusing "no such file or directory". Running `dos2unix` on the file fixes it.

## 7. A Percent Sign Broke the Line

Cron turns an unescaped `%` into a newline, so the command ends at the first one and the rest gets sent to it as input. Anything with a `date +%F` in it gets cut off halfway. Escape each one as `\%`, or move the command into a script. This one is easy to miss because the line looks fine.

## 8. It's in the Wrong Crontab

`crontab -e` and `sudo crontab -e` edit two different crontabs, one for your user and one for root. A job in root's crontab runs as root, and one in yours runs as you, with your permissions.

Check both with `crontab -l` and `sudo crontab -l`. And remember that `/etc/crontab` and the files in `/etc/cron.d/` need a user field between the schedule and the command, which personal crontabs don't have.

## 9. The File in /etc/cron.d Has the Wrong Name

On Debian and Ubuntu, cron ignores files in `/etc/cron.d/` whose names contain a dot, so `backup.cron` or `my.job` never runs. The same rule applies to scripts in `/etc/cron.daily/` and its siblings, which are run by `run-parts` and skipped if the name has an extension like `.sh`.

Name them `backup` or `my-job` instead. You can check what `run-parts` would run with `run-parts --test /etc/cron.daily`.

## 10. The Last Line Has No Newline

Some cron implementations ignore the final line of a crontab if it doesn't end with a newline. `crontab -e` usually handles it, but files written by a script or copied into `/etc/cron.d/` sometimes don't. Adding an empty line at the end avoids it.

## 11. Time Zones and Daylight Saving

Cron uses the server's time zone, which on a lot of cloud servers is UTC. A job meant for 9am Toronto time set to `0 9 * * *` on a UTC box runs at 4am or 5am local, depending on the season.

Daylight saving causes its own trouble. Debian's cron and cronie both try to smooth it over for jobs set to a fixed time: one that falls in the hour the clocks skip runs right after the change, and one in the hour that repeats runs only once. Jobs with a `*` in the minute or hour field just follow the new clock, so something like `*/10 2 * * *` doesn't run at all on the night 2am is skipped, and other cron implementations may skip or double a fixed-time run too. Scheduling outside the change (usually between 1am and 3am local time), or keeping the server on UTC, avoids all of it. `timedatectl` shows what zone the server is in.

## 12. It Ran, but the Output Went Nowhere

Sometimes the job runs and fails, and you never see why because cron mailed the error to a local mailbox nobody reads, or threw it away because the server can't send mail. Send the output somewhere you'll find it:

```bash
*/5 * * * *  /usr/local/bin/check-queue >> /var/log/check-queue.log 2>&1
```

The `2>&1` is the important part. Errors go to standard error, and without it they skip the log file and end up wherever cron sends output.

## A Routine That Finds It Fast

When a job won't run, this is what I do:

1. Check the log to see whether cron started it.
2. Temporarily set it to `* * * * *` so I don't wait an hour between attempts.
3. Add `>> /tmp/debug.log 2>&1` to capture everything it prints.
4. Run it with `env -i` to see it the way cron does.
5. Fix the problem, then put the schedule back.

## Getting an Alert When a Job Fails

None of these problems announce themselves. A backup can stop running after a `PATH` change and nobody notices until the day they need it.

That's why I built [CronWatch](https://cronwatch.dev). Each job pings it when it finishes, and if a ping doesn't arrive on schedule you get an alert the same day. **Logging tells you why a job failed, and a heartbeat tells you that it failed in the first place.** For anything you'd miss, you want both.

If you're moving a job somewhere other than a plain crontab, like GitHub Actions or a Kubernetes CronJob, the [Cron Converter](https://joncphillips.com/tools/cron-converter/) rewrites the expression in the format each one expects, along with the quirks of each.

Topics: [Engineering](https://joncphillips.com/topics/engineering/)
