Professional Web Applications Themes

Rsync Setup - FreeBSD

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 ...

  1. #1

    Default Rsync Setup

    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.

    Rob

    Robert Guest

  2. #2

    Default Re: Rsync Setup

    Robert Slade wrote: 

    you can only do one way at a time, so what you need to do is:

    rsync <options> machine_A:/pathA machine_B:/pathB
    rsync <options> 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
    Erik Guest

  3. #3

    Default Re: Rsync Setup

    Robert Slade wrote: 

    You want the "update" -u option:

    rsync -auv from to
    rsync -auv to from

    ....as in:

    % mkdir from to
    % touch from/a
    % echo 'hi' > to/a
    % touch to/b
    % echo 'bye' > from/b
    % rsync -auv from to
    building file list ... done
    from/
    from/a
    from/b

    sent 188 bytes received 60 bytes 496.00 bytes/sec
    total size is 4 speedup is 0.02
    % rsync -auv to from
    building file list ... done
    to/
    to/a
    to/b
    to/from/
    to/from/a
    to/from/b

    sent 321 bytes received 100 bytes 842.00 bytes/sec
    total size is 7 speedup is 0.02
    % cat to/a
    hi
    % cat to/b
    % cat from/a
    % cat from/b
    bye

    --
    -Chuck

    Chuck Guest

  4. #4

    Default Re: Rsync Setup

    At 2005-04-03T21:28:13+01:00, Robert Slade wrote:
     

    The `net/unison' port may be of use to you. See

    http://www.cis.upenn.edu/~bcpierce/unison/

    Raghavendra.

    --
    N. Raghavendra <ernet.in> | See mail headers for contact
    Harish-Chandra Research Institute | and OpenPGP details.

    N. Guest

  5. #5

    Default Re: Rsync Setup SOLVED

    On Mon, 2005-04-04 at 05:56, N. Raghavendra wrote: 
    >
    > The `net/unison' port may be of use to you. See
    >
    > http://www.cis.upenn.edu/~bcpierce/unison/
    >
    > Raghavendra.[/ref]

    Thank you and all the others who replied - problem solved.

    Rob

    Robert Guest

Similar Threads

  1. rsync help
    By Thommy in forum Linux / Unix Administration
    Replies: 4
    Last Post: February 26th, 03:30 AM
  2. rsync with ssh and a different cipher?
    By pbeckhelm@gmail.com in forum Linux / Unix Administration
    Replies: 4
    Last Post: February 11th, 09:25 PM
  3. Rsync for 5.0.6
    By Brent in forum SCO
    Replies: 9
    Last Post: November 7th, 03:45 PM
  4. using rsync
    By Steven in forum Mac Applications & Software
    Replies: 7
    Last Post: September 18th, 11:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139