On Jan 10, 2013, at 10:57 AM, Tim Daneliuk wrote:
> I have used rsync for many years to make sure a destination
> machine:directory is kept up-to-date with some source master
> directory.
> 
> I now need to find a way to keep two different machine:dirs
> in sync with each other.  But for any given file, I don't know
> which of these is newer so I don't know "which way" to sync.
> 
> For example given:
> 
> machineA::/dir/foo      machineB:/dir/foo
> machineA::/dir/bar      machineB:/dir/bar
> 
> Say the machineA has the newest foo, but machineB has the
> newest bar.  At the end of syncing, I want both machines
> to have the latest copies of everything.
> 
> I'm guessing there's a way to do this with rsync but I'm kind
> of stumped.

rsync's --update flag will not overwrite a file at the destination if it was 
modified more recently then the source location.  So you can run rsync twice to 
sync from A to B and then from B to A.  Make very sure both boxes are keeping 
correct time and/or are mutually sync'ed via NTP or similar.

However, if you make different changes to the same file on A and on B, you will 
lose one of them.  (That is what version control systems like SVN and git would 
resolve.  So if you do plan to do 2-way or N-way changes and sync'ing on a 
regular basis, version control is much less likely to lose changes or otherwise 
screw up.)

Regards,
--  
-Chuck

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to