On Fri, 11 Aug 2006 15:49:56 +0200 Francis GUDIN <fgudin@xxxxxxxxx> wrote: > Hello, > > I'm trying to solve a little issue: I wish to redirect my cron > jobs'output to log files. STDOUT redirection is done inside the > crontab, but VACUUM still yields its messages[1] through, onto > STDERR, I guess. I wouldn't like to '2>&1' also: I wish I could keep > STDERR (what if an error condition must be reported ?). > Is there a way to do so ? > > Thanks in advance, > > BR, > Francis Francis, Take a look at the "tee" command that takes stdin and writes it to stdout AND a file. If I understand you correctly you DO want to keep stdout and stderr as two separate streams, write (at least) std err to a log file, but have the error messages e-mailed to you as part of your cron job. The command line for that might look something like: ls tmp/nofile tmp/goodfile 2>&1 1>tmp/nofile.txt | tee tmp/nofile.err Here I've run the command ls on two files, one that exixts, and one that doesn't. In the first half (before the pipe or bar) I've redirected stdout to a file called "nofile.txt" and THEN redirected stderr to stdout. Redirection is read right to left just to be exciting. I pipe the result (stderr on stdout's descriptor) to the tee command which redirects stdout (stderr from the ls command) to another file AND prints it to stdout or the screen. Personally I don't think this is a neat solution but has the virtue of working. My own understanding of redirection is rudimentary at best. It's a topic well worth researching on it's own merit. Good luck. John Purser