[Toolserver-l] Job scheduling and mail receiving

Andre Koopal andre at molens.org
Wed Feb 9 21:14:45 UTC 2011


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



More information about the Toolserver-l mailing list