Hi,
Right now, the vanilla setup of crontab, prevents us to receive failure mail. Because:
- contrab is redirecting stdout to /dev/null
- run-parts is always emitting something and redirect stderr script channel into the stdout channel (so it goes into garbage).
We were able to fix all this with:
1) fixing /usr/bin/run-parts (see below).
2) removing the "1> /dev/null" from the cron tab.
run-parts original code:
Code:
# If we've made it this far, then run the script if it's executable:
if [ -x $SCRIPT ]; then
echo "$SCRIPT:"
echo
$SCRIPT 2>&1
echo
...
Our fix on run-parts:
Code:
# If we've made it this far, then run the script if it's executable:
if [ -x $SCRIPT ]; then
$SCRIPT 2>&1 || echo "$SCRIPT failed."
...
I guess we even should be able to just do
Code:
$SCRIPT || echo "$SCRIPT failed." 1>&2
which seems to me as even better.
Everything run smoothly, the only mail we have are "errors". Note that we CAN receive mail if something outputs to stdout, but usually a good unix tool, run silently if no error, and if it verbose something, its better(/easy) just to redirect THAT call and not everything...
Of course part of the comment on top of crontab might be deprecated if those fix are applied

.
Obviously, cron jobs scripts should have a normal behavior (we had to fix logrotate too, see
this thread)...
Cheers
Garry.