Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As someone about to write a cron job, what ways do you see Cron fail?

My assumption is that cron is robust and reliable, it's the job script itself that may fail silently and need monitoring, yes?



Yeah, I'd say your assumption is correct. However, other common ways that I've seen cron "fail" is for the cron entry to being installed in the wrong user's crontab, the permissions on a script changing such that it can't be executed, temporarily disabling or removing a cron job and forgetting to re-enable it, etc.


My favorite is forgetting a newline at the end of the crontab. I always put a warning at the bottom of my crontabs.

# Always end with a newline!


The most common failure I've seen is when people forget to use full paths in cron.

bash instead of /bin/bash (or similar)


There's other weirdness in cron-land too. Cron will completely ignore files containing "." .


The cron process can be killed by the oom_killer, resulting in missed crons. This may be aggrevated If the cron service is never respawned later.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: