3

I would like to set up a task to sync 2 remote servers' files.

Historically I performed the following:

  1. SSH to Destination
  2. SU to user which has public key on Source
  3. Rsync over SSH to pull files to Source

Now however, the Source server has moved to a VPN for which the Destination does not have access to, so there is no longer a direct 'line of sight', so I'm now resorting to the following method:

  1. Rsync from Source to Local
  2. Rsync from Local to Destination

This has the downside however that a number of different Local machines may be used for the file syncing task, and so the overhead of a new local copy being created, or even the need to store a local copy on local machines is not preferable.

Is there a Linux / OSX based command line tool which can perform the above without needing a local copy?

2 Answers 2

2

If none of the source and destination can connect to the other end, there is no other way to copy the files other than copying them to a local machine as described.

However, you can do the following if you have troubles copying large amount of data:

  1. Copy the files and folders using several rsync commands.
  2. When done copying one file/folder to the local machine, copy it immediately to the other remote machine and remove it.

This way you can reduce the HD capacity needed to store the files locally. Also, you can write these in a script and use sleep to give the local machine some time to settle before resuming. You can use SSH keys to automate this to avoid prompting for a password. Of course, this assumes you don't need the data ASAP to copied to the other end.

0

Not exactly a command line tool, but do you have the ability to set up NFS mounts? Mounting the source and the destination filesystems should get you what you need.

1
  • NFS would be faster, but if it's not available SSHFS will work pretty much anywhere SSH does.
    – Kowh
    Feb 13, 2012 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.