From owner-freebsd-questions@FreeBSD.ORG Sun Apr 3 20:41:41 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 347F316A4CE for ; Sun, 3 Apr 2005 20:41:41 +0000 (GMT) Received: from top.daemonsecurity.com (FW-182-254.go.retevision.es [62.174.254.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9652143D53 for ; Sun, 3 Apr 2005 20:41:40 +0000 (GMT) (envelope-from norgaard@locolomo.org) Received: from [192.168.0.32] (charm.daemonsecurity.com [192.168.0.32]) by top.daemonsecurity.com (Postfix) with ESMTP id 62BA6FD068; Sun, 3 Apr 2005 22:41:39 +0200 (CEST) Message-ID: <42505500.5000902@locolomo.org> Date: Sun, 03 Apr 2005 22:41:36 +0200 From: =?ISO-8859-1?Q?Erik_N=F8rgaard?= Organization: Locolomo.ORG User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050314 X-Accept-Language: en, en-us, en-gb, da, fr, de, it, es MIME-Version: 1.0 To: Robert Slade References: <1112560093.15815.19.camel@lmail.bathnetworks.co.uk> In-Reply-To: <1112560093.15815.19.camel@lmail.bathnetworks.co.uk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: "freebsd-questions@freebsd.org" Subject: Re: Rsync Setup X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2005 20:41:41 -0000 Robert Slade wrote: > Hi, I'm trying to get my brain around rsync. What I am trying to do is > synchronise 2 directories on different machines. I have an rsync server > running on one machine and running it as a client on the other. I have > been able to get this setup to work. However, it just syncs the > directories on machine A with those on B. If B has a later version of > the file on A it gets overwritten with the older version from A. > > I have done a fair bit of reading on rsync which leads me to believe > that it will only work one way. Is this correct? If so, is there any > other way of synchronising the 2 directories so that they end up with > the latest version of the file(s) from either machine. you can only do one way at a time, so what you need to do is: rsync machine_A:/pathA machine_B:/pathB rsync machine_B:/pathB machine_A:/pathA Then what you need is to find the correct options so that the first rsync does not overwrite files that should have been synced the other way. options -u and -t seems to do that. You can do this as a batch script on just one of the machines, so you don't get any race conditions. My options are -Cuvaz, but I only sync one way. You should be carefull: if clocks on the servers are out of sync, you may get syncing the wrong way! and you will have problems deleting files, this has to be done both places. If you instead can assing one machine as master and the other as slave, so you only sync one way, then you avoid all these problems. Cheers, Erik -- Ph: +34.666334818 web: http://www.locolomo.org S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt Subject ID: A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9 Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2