Fix a Cron Job Not Running on Linux
cron job not runningscheduled task not firingworks manually but not in cronA 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's how to debug it.
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
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.
A VDS for your scheduled tasks
Run cron jobs, backups and bots reliably on our protected NVMe VDS plans in Frankfurt.
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.
Related articles
Fix SSH "Connection refused" / "Connection timed out"
SSH "connection refused" vs "timed out" — what each means and the exact steps to fix them.
Read fix Linux & VPSFix "Permission denied" on Linux (chmod & chown Explained)
"Permission denied" on a script or file? Understand chmod/chown and fix it the right way.
Read fix Linux & VPSHow to Check CPU, RAM & Disk Usage on a Linux Server
The essential commands to check CPU, RAM and disk on Linux — and find what's eating them.
Read fix