Unix Technical Forum

Redirection of cpio's messages

This is a discussion on Redirection of cpio's messages within the Sco Unix forums, part of the Unix Operating Systems category; --> OS: SCO Osr 5.0.7 with Maintenance Pack 5 I'm trying to,write a Bourne script that I can use to ...


Go Back   Unix Technical Forum > Unix Operating Systems > Sco Unix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-16-2008, 05:08 AM
Arby
 
Posts: n/a
Default Redirection of cpio's messages

OS: SCO Osr 5.0.7 with Maintenance Pack 5

I'm trying to,write a Bourne script that I can use to backup files. I hope
to redirect cpio's verbose output to a file, for later comparison with an
earlier file that contains the filenames that I wish to backup. In the
following script, cpio send its verbose outrput to the console, instead of
to the file named "backnames". Can anyone tell me why?

TIA,
Arby

# Remove backup status file
echo Bad Backup > /tmp/backup_status
echo > Daily
echo Daily > backnames
find /usr/myapp/db/* -depth -print >> backnames
echo "User requested a Daily backup." > /tmp/backnames

# Perform the backup
# Increased block i/o size from 1024 to 64 kB and media size to 79 GB: RB

cat backnames | cpio -ocaBv -C65536 -O/dev/mt \
-K7990000 > /tmp/backnames

# -K7990000 \
# -M "Please insert tape %d and then press RETURN: " > /tmp/backnames


# Compare /tmp/backnames to backnames. If a good backup, they'll match.
# (excluding media errors, of course.)
. . . etc


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-16-2008, 05:08 AM
Bill Campbell
 
Posts: n/a
Default Re: Redirection of cpio's messages

On Sun, Oct 07, 2007, Arby wrote:
>OS: SCO Osr 5.0.7 with Maintenance Pack 5
>
>I'm trying to,write a Bourne script that I can use to backup files. I hope
>to redirect cpio's verbose output to a file, for later comparison with an
>earlier file that contains the filenames that I wish to backup. In the
>following script, cpio send its verbose outrput to the console, instead of
>to the file named "backnames". Can anyone tell me why?


Most likely because the output is to standard error, not standard output.

>cat backnames | cpio -ocaBv -C65536 -O/dev/mt \
>-K7990000 > /tmp/backnames


This would be self-destructive as the command would empty
/tmp/backnames on startup, and could also be considered an
example of useless use of the cat command

Should be:

cpio -ocaBv -C65536 -O/dev/mt -K7990000 < /tmp/backnames > /tmp/cpioout 2>&1

The part ``2>&1'' joins standard output and standard error into a
single file stream.

Bill
--
INTERNET: bill@celestial.com Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676

What's this script do?
unzip ; touch ; finger ; mount ; gasp ; yes ; umount ; sleep
Hint for the answer: not everything is computer-oriented. Sometimes you're
in a sleeping bag, camping out.
(Contributed by Frans van der Zande.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:03 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com