Any Rsync Lords Here?

Is there a single cron command to keep 2 directories on different hosts mirrored or do I need to use 2 cron commands like I’m currently doing?
i.e. sshpass rsync server A to server B and vice versa

You would either need to setup a cron job (as you’ve suggested) which would be a little inefficient but not too bad (depends how critical that data is). Alternatively, this looks ideal for you.

1 Like

Maybe consider something like SyncThing which is designed for exactly this use case - keeping stuff in sync across multiple computers. It’s similar to Dropbox except peer-to-peer, so no server is required.

If you do want to stick with rsync, using inotify to only run rsync when files are modified should work reasonably well.

1 Like

Ive used syncthing in the past, but had some issues that made it an inviable solution. Inotify looks promising, I’ll definitely give that a try, thank you both for the suggestion

1 Like

You want to do sync both ways? Forget about using inotify, you will end up with data corruption.

Another option I just discovered: Unison File Synchronizer

If at all possible, I’d recommend having a master copy, and making the second copy read-only. Two way syncing always has the possibility of conflicts, if the same file is edited at both ends at the same time.

1 Like

Why do you not use something like GlusterFS?