*BSD News Article 46296


Return to BSD News archive

Xref: sserve comp.unix.bsd.misc:97 comp.unix.questions:66145 comp.unix.bsd.bsdi.misc:327
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.kei.com!hookup!lll-winken.llnl.gov!noc.near.net!mercury.near.net!tools.near.net!not-for-mail
From: barmar@nic.near.net (Barry Margolin)
Newsgroups: comp.unix.bsd.misc,comp.unix.questions,comp.unix.bsd.bsdi.misc
Subject: Re: redirection didn't work in cron
Date: 30 Jun 1995 19:34:02 -0400
Organization: BBN Planet Corporation, Cambridge, MA
Lines: 20
Message-ID: <3t21la$1fd@tools.near.net>
References: <3svhg3$ck0@news.mtu.edu> <VIXIE.95Jun29205021@gw.home.vix.com> <3svvur$7gc@miso.wwa.com>
NNTP-Posting-Host: tools.near.net

In article <3svvur$7gc@miso.wwa.com> dattier@miso.wwa.com (David W. Tamkin) writes:
>vixie@gw.home.vix.com (Paul A Vixie) wrote in
>| I suspect that it's telling you there is no "root" command.

>It very well might be, but shouldn't the shell that cron invokes be
>delivering that message (that there's no "root" command) to stderr, and
>isn't stderr pointed to /dev/null?

Redirection applies to the output of the command, not the shell.  If the
shell has trouble invoking the command in the first place, it sends the
error to its own stderr.  This is why Paul's example of using a subshell
suppresses the error message: the subshell's output is redirected.
However, if the shell has trouble forking the subshell you could still get
an error (although if the system is having trouble forking, it probably
won't be able to spawn the mail process, either).
-- 
Barry Margolin
BBN Planet Corporation, Cambridge, MA
barmar@{bbnplanet.com,near.net,nic.near.net}
Phone (617) 873-3126 - Fax (617) 873-5124