2

I have two Linux (Debian) machines "A" and "B" connected to each other wireless over the router.

On the machine "A" I run a script that generates every 5 seconds a new 1MB file in the specific folder (e.g. ~/files/). Files do not change after generation.

After the file is generated, it should be available on the machine "B" together with other files, that were generated previously.

What is the most efficient way (according to the CPU / network usage and transfer time), to do it?

Suggestions:

  • run scp in the script to copy the file after it was generated, so every file is copied individually.

  • run rsync to synchronize the folder contents between the machines.

2

Use rsync. SCP has a bigger overhead.

Also think of sharing connections using ControlMaster. If you would transfer this only file every 5 seconds, most of the time you would spend initiating connection, instead of transferring files.

2

Use Rsync,

Rsyc only copies files that have changed since the last copy and saves lots of bandwidth and CPU.

SCP is very tricky to only copy changed files, and per default copies the full folder each time.

1

You can also make a shared folder between those two machines with, say, NFS or another sharing protocol.

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.