HACKER Q&A
📣 maest

Python Wrapper for Cronjobs


I currently have a Python script I used to notify me whenever my cronjobs fail. My crontab looks like this:

  0 0 * * * job_monitor.py --to user@email --cmd my_cron_script.sh
The script is quite useful - it automatically emails any WARN or ERROR messages or cases where exit code is not 0 - but it's also sort of janky and feature limited.

This feels like it should be a common use-case, but I can't seem to find any open source libraries for this. This usually means one of two things: 1. I'm googling for the wrong thing 2. my approach is somehow wrong.

Are there any Python (or otherwise) tools that provide this behaviour?


  👤 jjgreen Accepted Answer ✓
Can't you just dispense with job_monitor.py altogether and just use the MAILTO facility?