in reply to Re: Copy file from one sereve to another server directly.
in thread Copy file from one sereve to another server directly.

Hi, Salva

For tempporary, I had implemented it by using Net::SFTP::Foreign. I had created 2 separate object of Net::SFTP::Foreign, one for reading from server1 and another for writing on server2. But its taking too much time(For 50mb file it is taking ~30min). Since data from server1 is coming to local machine and then it going to server2.

I had read how to combine Net::OpenSSH with Expect but I am not getting how to use it for scp. Please give me an example of how to use Expect for scp. If you dont mind.

  • Comment on Re^2: Copy file from one sereve to another server directly.

Replies are listed 'Best First'.
Re^3: Copy file from one sereve to another server directly.
by MidLifeXis (Monsignor) on Nov 13, 2014 at 14:31 UTC

    Update: ignore me. tobyink already said the same thing.

    Assuming that keys are set up properly for passwordless ssh/scp access like so:

    local ---SSH--> server1 ---SCP--> server2

    If I were to do this from the command line, I would do something along the lines of:

    local$ ssh server1 'scp $file server2:$remote_file'

    Implementing this in perl is left as an exercise for the reader :-)

    --MidLifeXis