I've been searching the threads for a way to do this, and have come up empty. Then again I don't seem to use the right search criteria...
We have a driver script which logs output to files which are used to be viewed via an online scheduling tool:
$EXECDIR/$process >> $PROC_LOG_FILE 2>&1
Within the KSH script being called by the driver, we write to a different log file, which is used for ops support. The way it's set today, all we do is echo certain things to the local log file via "echo | tee -a $LOCAL_LOG_FILE" command. This is problematic because we don't capture all the STDOUT and STDERR in this log. I would like both log files to contain the same information without touching the command from the driver script.
Basically we echo what we're going to do and write that to the local log. Then we run command, and it's STDOUT and STDERR is captured in the log file used for display on the web tool, but the local log file doesn't catpure this. I also would rather not do "cmd >> logfile 2>&1" for each of the commands in the script, so I was hoping there was an easier way to accomplish this....
I believe the subshell method stands a chance at working the way I need it to. The issue with Corona's approach is that the local log file would contain all the output and the other would contain nothing. I'll try it out....