Operating System - Linux
1819861 Members
2519 Online
109607 Solutions
New Discussion юеВ

Re: log output from a cpio backup

 
wvsa
Regular Advisor

log output from a cpio backup

Good afternoon all,

Running the following command: find /u01 | cpio -ov | gzip > /jonah_orastage/xxx Would like to be able to log the output from these commands to a file on the /jonah_orastage mount point. When I add >> /jonah_orastage/log 2>&1 to the end of the command the log file ends up capturing the cpio output. Any thoughts?

Thank you for the input.
4 REPLIES 4
Jeroen Peereboom
Honored Contributor

Re: log output from a cpio backup

Maybe tee woul do it (I cannot test):

Quote:
The tee command transcribes the standard input to the standard output and makes copies in the files.
End Quote

find /u01 | tee -a /jonah_orastage/log | cpio -ov | gzip > /jonah_orastage/xxx

There are ways around this, like first do find to a logfile, cat the logfile for the cpio, and append the logfile to /jonah_orastage/log.

JP.
Vernon Brown_4
Trusted Contributor

Re: log output from a cpio backup

You will probably need to put the command in a script and use two commands; one to cpio and one to log the result.

Vern
Stuart Browne
Honored Contributor

Re: log output from a cpio backup

Nah.. The output from 'cpio' goes to STDERR.

find /u01 | cpio -ov 2> /jonah_orastorage/log | gzip > /jonah_orstage/xxx

should suffice.
One long-haired git at your service...
wvsa
Regular Advisor

Re: log output from a cpio backup

Stuart Browne, your response was great, did exactly what I needed.

Thank You