Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jul 1999 22:40:14 +0100 (BST)
From:      Kieran <kieran@esperi.demon.co.uk>
To:        Khetan Gajjar <khetan@os.org.za>
Cc:        Dick Griffin <dick@dgriffin.org>, freebsd-newbies@FreeBSD.ORG
Subject:   Re: Stopping cron from sending mail
Message-ID:  <Pine.LNX.4.02A.9907182202390.22442-100000@cuchulainn.tirnanog>
In-Reply-To: <Pine.BSF.4.02A.9907181420180.13948-100000@pleb.cs.uct.ac.za>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 18 Jul 1999, Khetan Gajjar wrote:

> On Sun, 18 Jul 1999, Dick Griffin wrote:
> 
> >I have the same problem.  I'll be watching for the quidance you get.
> >Thanks for asking the question.
> 
> add '> /dev/null 2>&1' to the end of it,
> eg.
> 0	*	*	*	*	/usr/local/bin/fetchmail -silent > /dev/null 2>&1

This is correct, but it would probably be a good thing to understand
what is happening here, so here goes:

The UNIX shell has 3 "files" defined by default: 

standard in (usually the keyboard)
standard out (the normal output from any command. Goes to screen by
default)
and standard error (which is where error messages go to. Also goes to
screen by default)

For reasons lost in the mists of time, these have each been assigned a
number, and they can be directed to write/read from other places. Std.
in is 0, stdout is 1 and stderr is 2.

The code snippet above directs stdout to go to /dev/null, and then sends
stderr to the same place.

You can send them to different places as well. For example, if you were
compiling something, and wanted to know if anything failed, you night
use a line like this:

make 1>output 2>errors
(If you want to test how this works, try "grep -l _yourname_ *" in your
home directory. Your mailbox should include your name, and any
directories should give errors. Then try rediirecting.)

In the case of commands run by cron, standard out and standard error are
directed towards mailing root/ postmaster (I'm not sure about this bit
:-) 

The solution above sends all output to the bitbucket, which is what you
asked for. It might be a good idea to send stderr to somewhere you can
track it, in case something goes wrong that you night like to know
about.

Regards 

Kieran

Ps Sue, I hope that this sort of thing meets the freebsd-newbies
charter. I would have thought that this sort of thing is signal here,
but would be noise on freebsd newbies.




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.02A.9907182202390.22442-100000>