LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-27-2004, 12:52 PM   #1
rawii
LQ Newbie
 
Registered: Jan 2004
Posts: 5

Rep: Reputation: 0
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.
 
Old 01-27-2004, 12:55 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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
 
Old 01-27-2004, 12:59 PM   #3
rawii
LQ Newbie
 
Registered: Jan 2004
Posts: 5

Original Poster
Rep: Reputation: 0
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.
 
Old 01-27-2004, 01:07 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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}.
 
Old 01-27-2004, 01:11 PM   #5
rawii
LQ Newbie
 
Registered: Jan 2004
Posts: 5

Original Poster
Rep: Reputation: 0
OK, I'll give it a try.

Thanks
 
Old 01-27-2004, 01:49 PM   #6
rawii
LQ Newbie
 
Registered: Jan 2004
Posts: 5

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to redirect the soundcard output to a file? jr0 Linux - General 2 10-31-2005 06:29 AM
Is there a way in Linux/Unix bash to turn off output or redirect to a file jimwelc Linux - Newbie 6 01-06-2005 03:56 AM
How do I redirect sound card output to file ass0ciate Linux - Software 0 09-14-2004 03:41 PM
redirecting cpio screen output to file rawii Solaris / OpenSolaris 1 02-11-2004 09:28 AM
How to redirect standard output of piped command to log file andrewstr Linux - General 10 02-04-2004 02:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration