Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Apr 2002 10:37:49 -0500
From:      George Georgalis <george@galis.org>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        George Georgalis <george@galis.org>, Peter Leftwich <Hostmaster@Video2Video.Com>, "Scott M. Nolde" <scott@smnolde.com>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: find | cpio syntax [use scp]
Message-ID:  <20020404103749.D9116@trot.haven.dom>
In-Reply-To: <20020328224728.GB3044@hades.hell.gr>; from keramida@ceid.upatras.gr on Fri, Mar 29, 2002 at 12:47:28AM %2B0200
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020404103749.D9116>