I've been dealing with cron monitors that say a job "ran successfully" but that doesn't guarantee it's doing what I need it to. I'm concerned about real outcomes like if the job returns an error, outputs nothing, takes way too long, or even runs but creates an empty file. All I get is a simple "ping received" status, which doesn't help at all. Is there a reliable way to check for exit statuses, runtime issues, or the validity of the output, or is it common for people to just implement their own solutions?
4 Answers
Think about what "the job running successfully" actually looks like. Set up monitoring that checks your system state against expected outcomes. That way, you treat your cron jobs as interchangeable pieces without needing to change how you monitor them.
The reality is that if a job fails, it's often someone else's responsibility to deal with it. Cron just runs the commands you give it and doesn't do any checks for you. It's all about focusing on one task efficiently, in line with Unix philosophy.
You can actually manage this pretty easily with a bash script! It’s straightforward to capture errors and track job outputs effectively.
True, that's fine for one job on one server, but once you've got multiple jobs across different servers, you’ll really need good logging and alert systems in place. Otherwise, you might only find out something's broken when a user complains!
Your job should provide a status report on its own, regardless of the scheduler you’re using. Whether you’re on cron, systemd timers, or something else, having uniform output from the job itself is key. Start logging with something like syslog—it helps! It took me a good eight years to convince my team, but it’s worth it.

Do you have a simple example of your script? That could be really helpful!