From owner-freebsd-questions Thu Apr 4 7:38:55 2002 Delivered-To: freebsd-questions@freebsd.org Received: from trot.galis.org (ool-18bd0cd9.dyn.optonline.net [24.189.12.217]) by hub.freebsd.org (Postfix) with ESMTP id 325E937B41F for ; Thu, 4 Apr 2002 07:38:51 -0800 (PST) Received: (from gx@localhost) by trot.galis.org (8.11.6/8.11.6) id g34FbnW10365; Thu, 4 Apr 2002 10:37:49 -0500 Date: Thu, 4 Apr 2002 10:37:49 -0500 From: George Georgalis To: Giorgos Keramidas Cc: George Georgalis , Peter Leftwich , "Scott M. Nolde" , FreeBSD Questions Subject: Re: find | cpio syntax [use scp] Message-ID: <20020404103749.D9116@trot.haven.dom> References: <20020327215404.A39175@smnolde.com> <20020328005735.D97853-100000@earl-grey.cloud9.net> <20020328192151.GA1528@hades.hell.gr> <20020328160724.K15459@trot.haven.dom> <20020328224728.GB3044@hades.hell.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020328224728.GB3044@hades.hell.gr>; from keramida@ceid.upatras.gr on Fri, Mar 29, 2002 at 12:47:28AM +0200 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Just realized I never sent this... On Fri, Mar 29, 2002 at 12:47:28AM +0200, Giorgos Keramidas wrote: >On 2002-03-28 16:07, George Georgalis wrote: >> On Thu, Mar 28, 2002 at 09:21:51PM +0200, Giorgos Keramidas wrote: >> > >> >I customarily use ssh to copy files over ssh links: >> > >> > $ tar cvf - . | gzip -9c | ssh -T user@host 'mkdir foo ; cd foo ; gzip -cd | tar xf -' >> > >> >The trick is to properly quote the ssh command, so that it's not executed >> >by the local shell :-) >> >> I wouldn't mind seeing a translation using cpio, since I understand it can preserve more attributes. I tried but... >> >> doesn't work: find /var/tmp -print | cpio -oa | gzip -9c | ssh -T root@fait 'mkdir /tmp/foo ; cd /tmp/foo ; gzip | cpio -i' > >You missed the -cd options to the second gzip invocation (the one within >the quotes). there are still some problems... the sockets below (Invalid argument) didn't come over (even if they don't work on the new host shouldn't they come over?) and all of the mtimes have been reset to the time of the transfer. find /var/tmp -print | cpio -oa | gzip -9c | ssh -T root@fait 'mkdir /tmp/foo ; cd /tmp/foo ; gzip -cd | cpio -i' cpio: /var/tmp/ssh-XXKhaWtb/agent.1000: Invalid argument cpio: /var/tmp/ssh-XXNLjfGb/agent.10806: Invalid argument cpio: /var/tmp/-extended.pdf: truncating inode number cpio: /var/tmp/-extended.txt: truncating inode number and apparently because the full path is in the find statement, the files don't get extracted in /tmp/foo as expected, but in /var/tmp fixed with cd / ; find ./var/tmp -print | cpio -oa | ssh -T root@fait 'mkdir /tmp/foo ; if [ ! -d /tmp/foo ]; then mkdir -p /tmp/foo ; fi ; cd /tmp/foo | cpio -i' cpio: var/tmp: truncating inode number cpio: var/tmp/.fam_socket: truncating inode number cpio: var/tmp/formmail.tar.gz: truncating inode number and there's this... cpio: premature end of archive cd / ; find ./var/tmp -print | cpio -oa | ssh -T root@fait 'cd /tmp/fox || mkdir -p /tmp/fox && cd /tmp/fox | cpio -dim' --force-local -m --no-absolute-filenames MT_RSH Not sure what the 'truncating inode number' error is about. I guess I didn't finish experimenting with it... it really looks as if cpio can just use ssh as a shell. Anyone done that? // George -- GEORGE GEORGALIS, System Admin/Architect cell: 347-451-8229 Security Services, Web, Mail, mailto:george@galis.org File, Print, DB and DNS Servers. http://www.galis.org/george To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message