I've been trying to redirect output of errors from a script job (through cron) to mailx. This works fine, but I loose the stderr going out to the logfile. Ideally I'd like to get stderr & stdout to a log file AND stderr on it's own to mailx.
/tmp/test > /tmp/test.log 2 > 'mailx root'
I've been playing with variations of using "tee" to output to two destinations, but no joy...
I've also tried to manipulate file descriptors but still no joy...
/tmp/test > /tmp/test.log 3>&2 2>&1 3 > 'mailx root'
am I going in the right direction or lost altogether ?