Subject: Re: blocking some - not all - cron mails?
To: David Wetzel <dave@turbocat.de>
From: Mark E. Perkins <perkinsm@bway.net>
List: netbsd-help
Date: 02/16/2003 18:07:32
--On Sunday, February 16, 2003 23:08 +0100 David Wetzel
<dave@turbocat.de> wrote:

> hi folks,
> 
> how can I prevent cron from mailing me mail from only some crontab
> entries?
> 
> something like
> 
> 10      */2     *       *       *
> /usr/local/apache/webalyser/start.sh 2>&1 >/dev/null
> 
> does not work.

You need to flip the order of your redirctions:

  /usr/local/apache/webalyser/start.sh >/dev/null 2>&1

The bash(1) man page actually explains why this is so:

       Note that the order of redirections is  significant.   For
       example, the command

              ls > dirlist 2>&1

       directs  both  standard  output  and standard error to the
       file dirlist, while the command

              ls 2>&1 > dirlist

       directs only the standard output to file dirlist,  because
       the  standard  error  was  duplicated  as  standard output
       before the standard output was redirected to dirlist.

Cheers,
Mark