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`
if ! "$@" >$OUTFILE.out 2>$OUTFILE.err
then
cat $OUTFILE.out
cat $OUTFILE.err 2>&1
fi
rm $OUTFILE.{out,err}
Enjoy
--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html
=================================================================
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]