My home server runs a couple of shell scripts regularly for maintenance tasks - mostly backup, but also other stuff. I would like to be alerted in case anything fails but also keep a log of when it works.
Currently my setup looks like this:
- Cron calls one shell script which calls other scripts (just so the one won't get too complex). I decided to use one script with many tasks instead of individual cron items as I don't know how long each will take and I don't want them to interfere with one another.
- My cron setup contains a MAILTO line. I never get any errors.
- I don't have any logging. I just check from time to time whether the backup actually exists.
I know, I could implement into each script the functionality to log to a file (or syslog). Is there a way to define this from a central point so that I do not have to code this into every script individually?
Not sure how to achieve a better monitoring. I think a log analyzer system would be too much for this. Someone suggested running the scripts through Jenkins instead of shell/cron, but that seems to be even more effort.
What is a simple and good option?