Fix: Shell Script Works Manually But Fails in Cron

You’ve written a shell script. It works perfectly when you run it manually. You add it to cron, and… nothing. No output, no errors, just silence. This is one of the most common and frustrating problems in Linux administration. Here’s why it happens and how to fix it. The Root Cause: Environment Differences When you run a script manually, you get your full shell environment: $PATH, environment variables, your working directory, and all the context you’re used to. ...

April 4, 2026 Â· 4 min Â· 678 words Â· Rob Washington

Why Your Cron Job Isn't Running (And How to Fix It)

You added a cron job. It works when you run it manually. But cron just… doesn’t run it. No errors, no output, nothing. This is one of the most frustrating debugging experiences in Linux. Here’s a systematic checklist to find out what’s actually wrong. 1. Check If Cron Is Running First, make sure the cron daemon is actually running: 1 2 3 4 5 6 7 # systemd systems systemctl status cron # or systemctl status crond # Older init systems service cron status If it’s not running, start it: ...

April 2, 2026 Â· 5 min Â· 922 words Â· Rob Washington

Why Your Cron Job Isn't Running (And How to Fix It)

You added a cron job. You’re sure the syntax is right. But nothing happens. No output, no errors, just silence. Here’s how to figure out what’s wrong. Check If Cron Is Actually Running First, verify the cron daemon is alive: 1 2 3 4 5 6 7 # systemd systems systemctl status cron # or systemctl status crond # older systems service cron status If it’s not running, start it: ...

March 29, 2026 Â· 4 min Â· 759 words Â· Rob Washington

Why Is My Cron Job Not Running? A Debugging Checklist

You added a cron job. It should be running. It isn’t. The logs are silent. This is one of the most frustrating debugging experiences in Linux administration because cron fails silently by default. Here’s a systematic checklist to find the problem. 1. Is crond Actually Running? First, verify the cron daemon is running: 1 2 3 4 5 6 7 # systemd systems systemctl status cron # or systemctl status crond # Older init systems service cron status If it’s not running, start it: ...

March 25, 2026 Â· 5 min Â· 959 words Â· Rob Washington

Why Your Cron Job Works Manually But Fails in Cron

You’ve written a script. You test it manually: ./my-script.sh — works perfectly. You add it to cron, wait for the scheduled time… nothing happens. No output, no errors, just silence. This is one of the most frustrating debugging experiences in Linux. Let’s fix it. The Core Problem: Cron Runs in a Different Environment When you run a script manually, you’re running it in your interactive shell with: Your PATH variable (with all your custom directories) Your environment variables (loaded from .bashrc, .profile, etc.) Your current working directory Your user’s full shell configuration Cron runs scripts in a minimal environment with almost none of this. That’s the root cause of nearly every “works manually, fails in cron” issue. ...

March 21, 2026 Â· 4 min Â· 830 words Â· Rob Washington

Why Your Cron Job Isn't Running: A Troubleshooting Guide

You’ve added your cron job, the syntax looks right, but nothing happens. No output, no errors, just silence. This is one of the most frustrating debugging experiences in Linux administration. Here’s how to systematically find and fix the problem. Check If Cron Is Actually Running First, verify the cron daemon is running: 1 2 3 4 5 6 7 # systemd systems (Ubuntu 16.04+, CentOS 7+, Debian 8+) systemctl status cron # or on some systems systemctl status crond # Older init systems service cron status If cron isn’t running, start it: ...

March 14, 2026 Â· 4 min Â· 841 words Â· Rob Washington

Building Cron Jobs That Don't Fail Silently

Cron jobs are the hidden backbone of most systems. They run backups, sync data, send reports, clean up old files. They also fail silently, leaving you wondering why that report hasn’t arrived in three weeks. Here’s how to build scheduled jobs that actually work. The Silent Failure Problem Classic cron: 1 0 2 * * * /usr/local/bin/backup.sh What happens when this fails? No notification No logging (unless you set it up) No way to know it didn’t run You find out when you need that backup and it’s not there Capture Output At minimum, capture stdout and stderr: ...

March 11, 2026 Â· 5 min Â· 1044 words Â· Rob Washington

Cron Jobs Done Right: Scheduling Without the Pain

Cron has been scheduling Unix tasks since 1975. It’s simple, reliable, and will silently fail in ways that waste hours of debugging. Here’s how to use it properly. Cron Syntax │ │ │ │ │ └ ─ │ │ │ │ └ ─ ─ ─ │ │ │ └ ─ ─ ─ ─ ─ │ │ └ ─ ─ ─ ─ ─ ─ ─ │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ c ─ ─ ─ ─ ─ o m D M D H M m a o a o i a y n y u n n t r u d o h o t f f ( e ( 0 w 1 m - ( e - o 2 0 e 1 n 3 - k 2 t ) 5 ) h 9 ( ) 0 ( - 1 7 - , 3 1 0 ) a n d 7 a r e S u n d a y ) Common Schedules 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # Every minute * * * * * /script.sh # Every 5 minutes */5 * * * * /script.sh # Every hour at minute 0 0 * * * * /script.sh # Daily at 3 AM 0 3 * * * /script.sh # Weekly on Sunday at midnight 0 0 * * 0 /script.sh # Monthly on the 1st at 6 AM 0 6 1 * * /script.sh # Every weekday at 9 AM 0 9 * * 1-5 /script.sh # Every 15 minutes during business hours */15 9-17 * * 1-5 /script.sh The Silent Failure Problem Cron’s default behavior: run command, discard output, send errors to email (which you probably haven’t configured). ...

March 5, 2026 Â· 5 min Â· 1035 words Â· Rob Washington

Cron Jobs That Don't Wake You Up at Night

Cron is deceptively simple. Five fields, a command, done. Until your job runs twice simultaneously, silently fails for a week, or fills your disk with output nobody reads. Here’s how to write cron jobs that actually work in production. The Basics Done Right 1 2 3 4 5 6 7 8 # Bad: No logging, no error handling 0 * * * * /opt/scripts/backup.sh # Better: Redirect output, capture errors 0 * * * * /opt/scripts/backup.sh >> /var/log/backup.log 2>&1 # Best: Timestamped logging with chronic 0 * * * * chronic /opt/scripts/backup.sh chronic (from moreutils) only outputs when the command fails. Perfect for cron — silent success, loud failure. ...

February 27, 2026 Â· 5 min Â· 896 words Â· Rob Washington

Cron Jobs Done Right: Scheduling That Doesn't Break

Cron has been scheduling tasks on Unix systems since 1975. It’s simple, reliable, and available everywhere. But that simplicity hides gotchas that break jobs in production. Cron Syntax ┌ │ │ │ │ │ ─ ─ ┌ │ │ │ │ ─ ─ ─ ─ ┌ │ │ │ ─ ─ ─ ─ ─ ─ ┌ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ┌ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ c ─ ─ ─ ─ ─ o ─ ─ ─ ─ ─ m ─ ─ ─ ─ ─ m ─ ─ ─ ─ a m ─ ─ ─ ─ n i ─ ─ ─ d n h ─ ─ ─ u o ─ ─ t u d ─ ─ e r a ─ y m ─ ( ( o 0 0 o n d - - f t a 5 2 h y 9 3 m ) ) o ( o n 1 f t - h 1 w 2 e ( ) e 1 k - 3 ( 1 0 ) - 7 , 0 a n d 7 a r e S u n d a y ) Common Schedules 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # Every minute * * * * * /path/to/script.sh # Every hour at minute 0 0 * * * * /path/to/script.sh # Every day at midnight 0 0 * * * /path/to/script.sh # Every day at 2:30 AM 30 2 * * * /path/to/script.sh # Every Monday at 9 AM 0 9 * * 1 /path/to/script.sh # Every 15 minutes */15 * * * * /path/to/script.sh # Every weekday at 6 PM 0 18 * * 1-5 /path/to/script.sh # First day of every month at midnight 0 0 1 * * /path/to/script.sh Special Strings 1 2 3 4 5 6 7 8 @reboot # Run once at startup @yearly # 0 0 1 1 * @annually # Same as @yearly @monthly # 0 0 1 * * @weekly # 0 0 * * 0 @daily # 0 0 * * * @midnight # Same as @daily @hourly # 0 * * * * Editing Crontabs 1 2 3 4 5 6 7 8 9 10 11 # Edit current user's crontab crontab -e # List current user's crontab crontab -l # Edit another user's crontab (as root) crontab -u username -e # Remove all cron jobs (careful!) crontab -r System Crontabs 1 2 3 4 5 6 7 8 9 10 11 # System-wide crontab (includes user field) /etc/crontab # Drop-in directory (no user field needed) /etc/cron.d/ # Periodic directories (scripts run by run-parts) /etc/cron.hourly/ /etc/cron.daily/ /etc/cron.weekly/ /etc/cron.monthly/ /etc/crontab format includes username: ...

February 24, 2026 Â· 7 min Â· 1349 words Â· Rob Washington