Cron job tutorials have a problem. They teach you the five-field syntax, show you a couple of examples like 0 2 * * *, and send you on your way. What they don't cover is everything that needs to go around the expression for the job to actually work reliably in production.
Here's what I mean.
Problem 1: Cron's PATH is not your PATH
The fix is to set PATH explicitly in your crontab or at the top of your wrapper script:
PATH=/usr/local/bin:/usr/bin:/bin
This single line prevents the most common class of "cron job runs but does nothing" failures.
Problem 2: Cron's default shell is sh, not bash
If your script uses any bash-specific syntax — arrays, [[ ]] conditionals, $() substitution styles — and cron is running it with sh, you'll get silent failures or unexpected behavior.
SHELL=/bin/bash
Add this to the top of your crontab. One line.
Problem 3: No logging means no debugging
If a cron job fails, where does the error go? By default: nowhere. It vanishes. Adding log redirection to every crontab entry is the fix:
0 2 * * * /path/to/script.sh >> /var/log/mybackup.log 2>&1
The 2>&1 captures stderr alongside stdout so you see command errors, not just your script's output.
Problem 4: Long-running jobs can stack on top of themselves
If you have a job that runs every 5 minutes but sometimes takes 8 minutes, a second instance starts before the first one finishes. Depending on what the script is doing (writing to a file, syncing a directory, running a database query), this can corrupt output.
Lock files via flock prevent this:
/usr/bin/flock -n /tmp/myjob.lock /path/to/script.sh
All of this is in a free tool
I built Cron Job Builder to handle all four of these automatically. You pick your schedule from dropdowns, check the options you want (logging, PATH, SHELL, MAILTO, lock file), and it generates the complete crontab entry — expression + wrappers + bash header — ready to paste into crontab -e.
It also shows you the next 10 scheduled run times so you can verify your expression is actually doing what you intend before you deploy it.
There are quick presets for the schedules you use constantly: daily 2am, every 6 hours, weekdays 9am, monthly on the 1st, every 15 minutes.
No login, no account, runs entirely in the browser. Free.
→ https://bashsnippets.xyz/tools/cron-job-builder.html
The rest of the library — free bash scripts for backup, log cleanup, disk monitoring, uptime checking — lives at https://bashsnippets.xyz.