Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* redirecting STDERR and crontab scripts
@ 1994-11-18 15:47 Eric Lease Morgan
  1994-11-21 15:54 ` Peter da Silva
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Lease Morgan @ 1994-11-18 15:47 UTC (permalink / raw)




How do I redirect STDERR in crontab scripts?

I have the following crontab script:

  30 3 * * * /bin/csh /usr/local/wais/bin/index all >& /usr/users/Eric/index.log

This script is intended to reindex my WAIS server data. As you
may or may not know, the WAIS indexer creates *voluminous*
output. Since I use the csh, the command: 

  /usr/local/wais/bin/index all >& /usr/users/Eric/index.log

works great from my command line. But when I run this script
from my crontab file, root reports an error:

  sh: /usr/users/Eric/index.log: bad number

If I change my crontab script to:

  30 3 * * * /bin/csh /usr/local/wais/bin/index all >& 2

I get a HUGE file in my mailbox.

How do I run a crontab script and redirect the STDERR to a
file in my directory, without getting anything sent to my
mailbox?

Eric Lease Morgan
NCSU Libraries
eric_morgan@ncsu.edu
http://www.lib.ncsu.edu/staff/morgan/




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: redirecting STDERR and crontab scripts
  1994-11-18 15:47 redirecting STDERR and crontab scripts Eric Lease Morgan
@ 1994-11-21 15:54 ` Peter da Silva
  0 siblings, 0 replies; 2+ messages in thread
From: Peter da Silva @ 1994-11-21 15:54 UTC (permalink / raw)


In article <3aii9r$dt3@taco.cc.ncsu.edu>,
Eric Lease Morgan  <eric_morgan@ncsu.edu> wrote:
>   /usr/local/wais/bin/index all >& /usr/users/Eric/index.log

>   sh: /usr/users/Eric/index.log: bad number

The crontab commands are run under /bin/sh.

Use /bin/sh redirect syntax:

	/usr/local/wais/bin/index all >/usr/users/Eric/index.log 2>&1

That means "redirect sdout to index.log, redirect stderr to stdout".

>   30 3 * * * /bin/csh /usr/local/wais/bin/index all >& 2

This means "redirect stdout to stderr".

> How do I run a crontab script and redirect the STDERR to a
> file in my directory, without getting anything sent to my
> mailbox?

See above.
-- 
Peter da Silva                                            `-_-'
Network Management Technology Incorporated                 'U`
1601 Industrial Blvd.     Sugar Land, TX  77478  USA
+1 713 274 5180                       "Hast Du heute schon Deinen Wolf umarmt?"


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-11-21 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-11-18 15:47 redirecting STDERR and crontab scripts Eric Lease Morgan
1994-11-21 15:54 ` Peter da Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox