On 02/09/2011 03:22 AM, River Tarnell wrote:
Or, if you only wanted to receive output on failure:
#! /bin/ksh
f=$(mktemp)
trap "rm -f $f" 0
/path/to/mytool>$f 2>&1 ||<$f mailx -s "Tool output" $LOGNAME
Just out of curiosity... is there a particular reason for the -f switch
to rm here, or are you just trying to be extra sure the tempfile gets
deleted?
I think you're the first person who's asked
about this, but it seems
like a useful feature, so I'll see if there's a way to make it easier.
I remember being disappointed by the lack of stderr output in the mail I
got after switching my Commons MIME type statistics script over to SGE,
but then I just thought "meh, I'm logging to a file anyway, I can always
just look there if something goes wrong."
--
Ilmari Karonen