On Wed, Feb 09, 2011 at 01:22:30AM +0000, River Tarnell wrote:
> 
> Or only if the command generated output:
> 
>       #! /bin/ksh
>       f=$(mktemp)
>       trap "rm -f $f" 0
>       /path/to/mytool >$f 2>&1
>       test -s $f && <$f mailx -s "Tool output" $LOGNAME
> 
If you only want to get mail when there is output, you can simply do:

/path/to/mytool | 2>&1 mail -e -s "Tool output" $LOGNAME

the -e will tell mail to suppress sending mail when stdin is empty.

Regards,

Andre

_______________________________________________
Toolserver-l mailing list ([email protected])
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

Reply via email to