-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
In article 4D516A08.5050503@surfeu.ch, Dr. Trigon dr.trigon@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.