I have several backup scripts I am improving which involves mksysb, savevg and tar.
Is there a way to have the output of any command sent to the standard output as usual (terminal) and at the same time, send a copy of it all into a file ? Normal outputs and error outputs.
Even if I am checking the status of the backup process, I know my client. They will ask that I display on the terminal the output of the backup so they see it running. But if there is a problem, scrolling the window all the way back to the start of the backup will not be possible (too much output). So if I can send all the output to a file, I could either do a grep from it to spot the error or let the operator view the file to find the errors himself (media error, ...).
added comments...
I saw similar posts done. I am checking them out...
Forgot to mention I am on AIX 4.2 with Korn shell
added comments ...
testing it with TAR
tar cvfpdl /dev/rmt0 . 2>&1 | tee -a /tmp/test.log
it only displays and copies the warnings/errors
tar cvfpdl /dev/rmt0 . | tee -a /tmp/test.log
does the same thing. I need the whole thing on console and in a file.
will continue to check other threads... (by the way, after each backup actions, I am checking the $? status for status and do actions accordingly).