[Toolserver-l] Job scheduling and mail receiving

River Tarnell r.tarnell at IEEE.ORG
Wed Feb 9 01:22:30 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In article <4D516A08.5050503 at surfeu.ch>,
Dr. Trigon <dr.trigon at surfeu.ch> wrote:
> Just a short question in [1] is mentioned how to trigger a mail in case
> 
> * the job starts
> * the job finishes
> 
> what about
> 
> * the job print something to stdout like for CRON jobs (in the early
>   days... ;))

I don't think there's a built-in method of doing this.  You could use a 
wrapper script that did something like:

	#! /bin/ksh
	/path/to/mytool 2>&1 | mailx -s "Tool output" $LOGNAME

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

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

... etc.

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.

	- river.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk1R7FIACgkQIXd7fCuc5vKEPgCdEJj19ST9Kmz1jknYCtFSo09x
iH0AnRMSq1OPN4N+20/8MtsaxmjgO8Ac
=3lS2
-----END PGP SIGNATURE-----



More information about the Toolserver-l mailing list