Thanks. Looks like a good place to start.
I have a few questions below ....
On Sunday 27 August 2006 18:03, Shachar Shemesh wrote:
> Aharon Schkolnik wrote:
> > Hi.
> >
> > I need a wrapper for cron jobs that will only send me stdout and stderr
> > if the job failed.
> >
> > I once had a wrapper like this, but I lost it, and can't find it with
> > google.
> >
> > Anyone have one l laying around ?
> >
> > TIA.
>
> I'm programming this into the mail, so totally untested:
>
> #!/bin/sh
>
> OUTFILE=`mktmp -t quiet.XXXXXXX`
>
Woudn't it be better to redirect both stdout and stderr to the same file, in
order to maintain the chronological relationship between them ?
> if ! "$@" >$OUTFILE.out 2>$OUTFILE.err
> then
> cat $OUTFILE.out
If I understand this correctly, you are redirecting the stderr from the cat
command to its stdout. Is that correct, and what you meant ?
Maybe you meant to redirect the stdout to stderr ?
cat $OUTFILE.err >&2
> cat $OUTFILE.err 2>&1
> fi
>
> rm $OUTFILE.{out,err}
>
>
> Enjoy
--
The day is short, and the work is great, | Aharon Schkolnik
and the laborers are lazy, and the reward |
is great, and the Master of the house is | [EMAIL PROTECTED]
impatient. - Ethics Of The Fathers Ch. 2 | 050-8724844
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]