Remote archiving with tar over ssh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, 2005-08-12 at 11:52, James B. Byrne wrote:

> d. I cannot get tar to pipe find'ed files to the remote server over 
> ssh.
> 
> My current command line looks like this.
> 
> find / -name "*.conf" | xargs -t tar -zcvf - | ssh \
> hostname.domain.tld \
> "cat > /var/spool/lvm_backups/hostname.city/confs.$(date 
> +'%Y%m%d').tar.gz"
> 
> I have tried replacing "tar -zcvf -" with "tar -zcvf - {}" and "tar -
> zcvf {}" to no avail.  The problem is that tar does not see the pipe 
> to ssh and exits with signal 13.  What am I missing? 

That looks right, but I'd guess that xargs isn't constructing
quite the command you expect.  It isn't safe for several reasons
(files with newlines or shell metacharacters in the name, for
example, or a big enough expansion that xargs decides it need
to run the command more than once).  I'd probably use cpio
instead of tar for something that needs to be driven by
find, but it would probably also work to use the gnutar option
"-T -" to make it read the file list from stdin.  But think
about what happens if someone names a directory xxx.conf...

-- 
  Les Mikesell
    lesmikesell@xxxxxxxxx



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux