I've noticed that most cron monitors are pretty much useless when it comes to actually verifying if jobs are doing what they're supposed to do. Just because a script runs doesn't mean it's working correctly. For example, I care about whether:
- it returns an error,
- it outputs anything at all,
- it takes significantly longer than usual,
- or it 'succeeds' but ends up writing an empty file.
All I see is a notification saying '✓ ping received' as if everything's perfect. Is there actually a solution out there that can check things like exit status, runtime issues, or the sanity of the output? Or does everyone just end up building their own systems for this?
5 Answers
You can catch errors directly in your scripts. Consider adding checks for output or using the system clock to monitor execution times effectively.
Cron monitors primarily verify that your job is running, not whether it’s working correctly. The detailed error checks need to be integrated into your job or script. After all, how can a monitor determine what a successful outcome actually looks like?
One approach is to create a second cron job that monitors the output of the first job. This way, you can check if it worked as expected.
Try adding condition statements at the end of your scripts. You can check for errors and then only trigger the cron monitor if something goes wrong.
Your concerns are valid, but those four scenarios you mentioned might be typical for a script's operation. It’s your responsibility to define and check what success actually means for your specific case.

Yeah, it's like a stack of cron jobs keeping an eye on each other!