From owner-freebsd-newbies Sun Jul 18 14:40:33 1999 Delivered-To: freebsd-newbies@freebsd.org Received: from esperi.demon.co.uk (esperi.demon.co.uk [194.222.138.8]) by hub.freebsd.org (Postfix) with ESMTP id 384F814FCE for ; Sun, 18 Jul 1999 14:40:24 -0700 (PDT) (envelope-from kieran@esperi.demon.co.uk) Received: from cuchulainn.tirnanog (4000@cuchulainn.tirnanog [192.168.1.68]) by esperi.demon.co.uk (8.9.3/8.9.3) with ESMTP id WAA07687; Sun, 18 Jul 1999 22:40:15 +0100 Received: from localhost (kieran@localhost) by cuchulainn.tirnanog (8.9.1/8.9.1) with SMTP id WAA11653; Sun, 18 Jul 1999 22:40:15 +0100 Date: Sun, 18 Jul 1999 22:40:14 +0100 (BST) From: Kieran X-Sender: kieran@cuchulainn.tirnanog To: Khetan Gajjar Cc: Dick Griffin , freebsd-newbies@FreeBSD.ORG Subject: Re: Stopping cron from sending mail In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-newbies@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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