Re: scp in a multi-piped command?

From: Darren Dunham (ddunham_at_redwood.taos.com)
Date: 01/23/04


Date: Fri, 23 Jan 2004 21:51:33 GMT

Jared <jared@hwai.com> wrote:
> Hi all,

> I am trying to determine a means of:

> exporting from Oracle |
> passing it through gzip or compress |
> transferring the file |
> gzip -d or uncompress on the other end |
> import into Oracle

> It is very straightforward to take an Oracle export and pipe it to
> 'compress'. This works, and is a well-known technique. What I want
> to do is use scp in batch mode for the transfer.

scp transfers files, not pipes. You'll want ssh.

# run the ssh on the sending end.
ls -l | compress | ssh host "uncompress > /file/location"

# run the ssh on the receiving end
ssh host "ls -l | compress" | uncompress > /file/location

Or let ssh do the compression...

ls -l | ssh -C host "cat - > /file/location"

Just change the commands above with the ones you want.

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


Relevant Pages