For those short of attention span:
Know what you are doing, use what is offered to you.
Crontabs are a powerful feature of Unix operating systems. With a simple command and a line of text, you can set up a command to run repeatedly, at very precisely specified intervalls, to do your bidding.
Most people working on a Unix machine know that.
But apparently most people ignore the fact that any output of a cronjob is automatically mailed to the user running the job.
This is most likely due to the job run as some “technical user”, which was not configured to forward its mail to some real person.
This has several consequences:
1) A script run as cronjob should only generate output in case of error (or for some really important statistics). Forwarding all standard output to a logfile is a smart move; better even is having some rollover tool installed and appending the output to a logfile that contains the last X lines of output at all times.
2) Having thousands of logfiles sit around in a technical user’s unchecked mailbox is several flavors of stupid. Make sure that the mail sent out in case of error actually reaches someone. echo yourmail@yourdomain > ~/.forward
. It’s not that difficult, is it?
I had thought these two were pretty obvious. After wading through endless lists of unread tech-user mails on half a dozen servers, it seems I am mistaken.
The only thing not making me hang my head in frustration is the morbid humor of finding out that a good percentage of the cronjobs I was looking at ceased working correctly months, even years ago. No-one ever realized. Finding out might make me look good in front of my superiors, but it doesn’t reflect well on my trade in general…