On Thu, 23 Jan 2003, Bapi Ghosh wrote:

> tar .... > /dev/null 2>&1

This is backwards. You needs to redirect stderr before redirecting stdout:

        foo 2>&1 > /dev/null

Or, the MAILTO line in the crontab can be tweaked (it works in a top-down 
fashion):
        
        # Mail results to [EMAIL PROTECTED] until otherwise specified.
        [EMAIL PROTECTED]
        * * * * * foo
        * * * * * bar
        #
        # No output on following items.
        MAILTO=""
        * * * * * baz

The foo and bar lines will have output mailed, but baz won't. I still 
don't think it's a good idea to close output, whether using MAILTO or 
/dev/null, but those are the options.

A much better technique would be to *minimize* output so that you only get 
an email when a cron job fails. A simple way to do this would be:

        * * * * * foo 2>&1 > /dev/null || echo "Foo failed. Fix me."

Otherwise, you might never know there's been a problem.

-- 
"Of course I'm in shape! Round's a shape, isn't it?"



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to