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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| ||||
| 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.) |