Skip to content
Linux & VPS

Fix a Cron Job Not Running on Linux

cron job not runningscheduled task not firingworks manually but not in cron
8 min read Updated 12 June 2026 ESAGAMES Team

A cron job that runs fine by hand but never fires on schedule is a classic. It's almost always the environment cron runs in — PATH, paths, or permissions. Here is how to debug it.

If a job runs perfectly by hand but never fires on schedule, it's almost always that cron runs in a stripped-down environment. These are the usual culprits, most common first:

SymptomCauseFix
"command not found" in cron onlyCron has a minimal PATHUse absolute paths (/usr/bin/php …)
Script runs but can't find its filesCron doesn't run from the script foldercd into it, or use absolute paths inside
Nothing happens at allBad crontab syntax or missing final newlineFix the 5 time fields; end the file with a newline
Permission deniedScript not executable / wrong userchmod +x, and check whose crontab it's in
Works sometimes, not alwaysWrong timezone or overlapping runsCheck the system TZ; add a lock to avoid overlap

Is cron even running?

Confirm the cron service is active and check the schedule:

systemctl status cron    # or crond on RHEL/Alma
crontab -l               # list this user's jobs

Cause 1: a minimal PATH

Cron runs with a bare environment, so commands that work in your shell (because of your PATH) fail. Use absolute paths for everything:

# bad:  php script.php
# good:
0 * * * * /usr/bin/php /home/user/script.php

Cause 2: relative paths inside the script

Cron doesn't run from your script's folder. Either cd into it first or use absolute paths inside the script:

0 3 * * * cd /home/user/app && /usr/bin/php backup.php

Cause 3: see the actual error — log the output

By default you never see why it failed. Redirect output to a log and read it:

0 3 * * * /usr/bin/php /home/user/backup.php >> /home/user/cron.log 2>&1
Crontab needs a final newline

A classic gotcha: a crontab file must end with a newline, or the last job silently won't run. Also remember % must be escaped as \% in cron commands.

Works by hand, not in cron = environment. Use absolute paths, log the output with >> log 2>&1, and read why it failed.

Cause 4: wrong crontab syntax or schedule

A malformed schedule (six fields instead of five, or an invalid range) makes cron silently ignore that line. Validate the schedule syntax against the man page or an online cron expression checker before assuming something else is wrong.

Cause 5: file or script permissions

If the script isn't executable, or the user cron runs as can't read/write files it touches, the job fails silently unless you're logging output. Confirm permissions with ls -l and that the crontab's user actually owns or can access the files — see permission denied on Linux.

Cause 6: wrong crontab (user vs system vs root)

A job added with crontab -e as one user won't run for another. Make sure you're editing the crontab for the user you expect, or use /etc/cron.d/ for system-wide jobs, which need an extra username field.

How to prevent cron issues

  • Always use absolute paths for commands and files.
  • Always redirect output to a log.
  • Test the exact command manually as the cron user, not your own login.
  • Keep a monitoring/alert — even a simple heartbeat ping — on critical jobs like backups.

Related errors

If the job runs but a command inside it fails with a permissions error, see permission denied on Linux. For checking what resources a scheduled job is using, see checking CPU/RAM/disk usage. New to the shell? Start with essential Linux commands.

A VDS for your scheduled tasks

Run cron jobs, backups and bots reliably on our protected NVMe VDS plans in Frankfurt.

See VDS plans
FAQ

Frequently asked questions

Why does my cron job work manually but not on schedule?

Cron runs with a minimal environment and a bare PATH, and not from your script's directory. Commands or relative paths that rely on your shell setup fail. Use absolute paths and cd into the working directory.

How do I see why a cron job failed?

Redirect its output to a log file by appending >> /path/cron.log 2>&1 to the cron line. Then read that log — it shows the actual error cron hit.

Why isn't my last cron job running?

A crontab file must end with a newline character, or the final line is ignored. Add a blank line at the end. Also escape any % signs as \% in the command.

How do I test a cron job as the exact user it will run as?

Use su - username -c "your command" (or sudo -u username command) to run it exactly as cron would, including its minimal environment. If it fails there but works in your own shell, that confirms an environment/permissions issue.

Why does my cron job fail only on some servers?

Different distros ship different default PATHs and shells for cron. Always set explicit absolute paths and, if needed, a SHELL=/bin/bash line at the top of the crontab so behavior is consistent everywhere.

Can I schedule a cron job to run every few minutes?

Yes — use */5 * * * * for every 5 minutes, for example. Just be careful that fast schedules don't overlap if the job can run longer than the interval; add a lock file check if that's a risk.

Knowledge base

Related articles

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.

Payments Secure checkout with cards, banking apps and digital wallets.

Choose the payment flow that fits your stack and region without leaving the platform.

Pay by Zen Visa Mastercard Paysafecard PaysafeCash Skrill Trustly Bancontact UnionPay iDeal WebMoney