LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   output from cpio won't redirect to file (https://www.linuxquestions.org/questions/programming-9/output-from-cpio-won%27t-redirect-to-file-139266/)

rawii 01-27-2004 12:52 PM

output from cpio won't redirect to file
 
I have a backup script that works but I can't seem to get the output from the cpio command to go to a file.

cpio -ov -H odc <${file_list} | rsh prod dd of=/dev/rmt/0 obs=128k >> ${buday}

The commands above and below this line are redirecting the output correctly.

druuna 01-27-2004 12:55 PM

Are (some of) those messages written to stderr?

This might do the trick:

cpio -ov -H odc <${file_list} | rsh prod dd of=/dev/rmt/0 obs=128k >> ${buday} 2>&1

rawii 01-27-2004 12:59 PM

What I am getting is the file names that are being backed up shown on the screen and I would like to capture them to a file. Currently, I am not rerouting any of the error messages.

druuna 01-27-2004 01:07 PM

You are rerouting ;)

The >> ${buday} part 'reroutes' stdout to a file. This is short for 1>> ${buday}.

My guess was (and is) that the other messages are comming from stderr (which is normally send to your terminal), so that's why I suggested the 2>&1 addition. All comming from stderr is redirected to stdout, all comming from stdout is redirected to ${buday}.

rawii 01-27-2004 01:11 PM

OK, I'll give it a try.

Thanks

rawii 01-27-2004 01:49 PM

I did the
cpio -ov -H odc <${file_list} | rsh prod dd of=/dev/rmt/0 obs=128k >> ${buday} 2>&1
and added the ${buday} in between the cpio switchs and the <${file_list} and it now works.
cpio -ov -H odc 2>>${buday}<${file_list} | rsh prod dd of=/dev/rmt/0 obs=128k >>
Thanks for all you help
Thanks for all your help.


All times are GMT -5. The time now is 10:53 AM.