tar hangs after extracting from pipe
Hello,
I'm making some backup files with predefined sizes for cd storage with the folowing command. # tar cvPf - /home | gzip v - | split -b 600m - backup.tar.gz.* This generates a number of files like backup.tar.gz.aa backup.tar.gz.ab backup.tar.gz.ac ... and so on. Problem is, when I extract from these files with the command # cat backup.tar.gz.* - | tar xzvPf - Everything works great, except that, after extracting the files, the prompt hangs. So I have to Ctrl+C to get it back. I've experimented with tar parameters, but no success so far. Any help will be greatly appreciated. System is: Linux version 2.6.18-6-686 (Debian 2.6.18.dfsg.1-23etch1) Thanks. Eric |
It's been a little while since I've written any shell scripts but would it work to use something like "exit" or "break" to force the script to end after your files are extracted?
|
Curiously it doesn't work.
When I do: # cat backup.tar.gz.* - | tar xzvPf - && break or # cat backup.tar.gz.* - | tar xzvPf - && exit It just hangs as if exit or break were not there. So I infer that, as the tar command doesn't return the prompt, exit or break are actualy never reached. On the other hand, when I try: # cat backup.tar.gz.* - | tar xzvPf - | break The prompt displays a warning saying that break must be used solely on loops. And: # cat backup.tar.gz.* - | tar xzvPf - | exit The tar process is inerrupted prematurely and not all tared files are extracted. When I try: # cat backup.tar.gz.* - | tar xzvPf - > exit Prompt hangs as if > exit were not even there. So.. I think I'm running out of options :] Thank you for the reply, though. |
tar won't know where the end of file is because you split the output.
You could try sorting the list before input, so tar is extracting in the right order. You could concatenate the files first, before extraction. I think there are tools that will do all this for you instead of tar. See the page here http://www.debianhelp.co.uk/backuptools1.htm |
Quote:
Quote:
Code:
# cat backup.tar.gz.* | tar xzvPf - |
Quote:
|
Quote:
The solution I found was adding nohup to the beginning of the command, as in: # nohup cat test.tar.gz.a* - | tar xzvP And I got away with a warning: gzip: stdin: decompression OK, trailing garbage ignored tar: Child returned status 2 tar: Saída por erro atrasada pelos erros anteriores (translating last line from portuguese) tar: Error exit delayed by previous errors Thank you for your help. |
I was referring to the first "-".
Code:
cat backup.tar.gz.* - | tar xzvPf - |
Quote:
Working command is # cat backup.tar.gz.* | tar xzvP or # cat backup.tar.gz.* | tar xzvPf - Being that the first makes more sense to me. Thank you. |
All times are GMT -5. The time now is 01:37 AM. |