I am trying to create a one line command that will:
1. Find all files ending in .conf 2. tar these over ssh to a remote server.
I have reached this point in my trials.
a. I can find the files.
b. I can tar them locally.
c. I can get a simple fileset tar'ed to a remote server over ssh using tar -zvcf - /some/fileset | ssh host.domain.tld "cat > /backup/tarfile.tar.gz
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?
Regards, Jim
Any particular reason you're not using something like rsync -av -e ssh or similar (or if not sure on rsync, might be an avenue worth looking at, I use it all the time)?
On 8/12/05, James B. Byrne ByrneJB@harte-lyne.ca wrote:
I am trying to create a one line command that will:
- Find all files ending in .conf
- tar these over ssh to a remote server.
I have reached this point in my trials.
a. I can find the files.
b. I can tar them locally.
c. I can get a simple fileset tar'ed to a remote server over ssh using tar -zvcf - /some/fileset | ssh host.domain.tld "cat > /backup/tarfile.tar.gz
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?
Regards, Jim
--
*** e-mail is NOT a secure channel *** James B. Byrne mailto:ByrneJB.<token>@Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3CE delivery <token> = hal _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 8/12/05 9:52 AM, James B. Byrne wrote:
I am trying to create a one line command that will:
- Find all files ending in .conf
- tar these over ssh to a remote server.
How about
tar c $(find / -name *.conf) | ssh host.com "gzip -c > file.tar.gz"
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...
On 8/12/05, Les Mikesell lesmikesell@gmail.com wrote:
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 \
Why not: $rsync -avzP -e ssh -n --exclude-from=somefile /path/to/your/source ip:/path/to/remote
some file is: + *.conf - *.*
path to source is your directory from where you wan to export - say /home path to remote is target directory where home is to be compied - say / Note: no ending "/" This will do a dry run on the screen. Once you are satisfied with the files you are getting remove -n from above and the job will be done.
man rsync for details.
Sorry this went away from what you were attempting.