[afnog] tar: Concatenate / Create from STDIN?

Begumisa Gerald M beg_g at eahd.or.ug
Sat Feb 25 18:55:27 EAT 2006


Hi,

I'm faced with an interesting issue.  I'm using a simple command to backup
a bunch of files from one machine to another.  I would like to end up with
one .tar.gz file on the remote machine.

Basically, the command below is repeated for the entire list of files I'm
backing up:

tar -cf - ./file1 | ssh backup-user at host "cat > /tmp/temp.tar; tar \
-Af /backup/full-backup.tar /tmp/temp.tar; rm /tmp/temp.tar"

As you can see, on the remote machine, I create a temporary tar file then
concatenate it with the full-backup.tar file which represents the full
backup.  At the end of the operation, I gzip the full-backup.tar file.

My question is - is there a way to concatenate one tar file with another
- where the second tar file comes from standard input.  This would help
eliminate the extra step on the remote machine.  Something like:

tar -cf - ./file1 | ssh backup-user at host "tar -Af \
/backup/full-backup.tar -"

Currently, it looks like the tar program will only read from standard
input when extracting files and not when updating (creating / appending /
concatenating) an archive.

Secondly, might anyone know how to gzip everything, all in one step
something like:

<wishful>
tar -cf - ./file1 | ssh backup-user at host "tar -zAf \
/backup/full-backup.tar.gz -"
</wishful>

Thanks in advance.


Cheers!
Gerald.



More information about the afnog mailing list