rsync when working on both sides... - Tools

This is a discussion on rsync when working on both sides... - Tools ; Hi rsync devs and users, I want to use rsync to synchronize home directories on two PCs. It works fine if I start rsync after working on a host each time I leave. But instead of operating modes "host1 -> ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: rsync when working on both sides...

  1. rsync when working on both sides...

    Hi rsync devs and users,

    I want to use rsync to synchronize home directories on two PCs. It works
    fine if I start rsync after working on a host each time I leave. But
    instead of operating modes "host1 -> host2" and "host2 -> host1" I would
    like to have a mode "host1 <-> host2" to allow synchronizing at any time
    -> Scenario:
    - on host1 files A,B have been created, C has been deleted
    - on host2 file D has been modified, E deleted
    Desired result after invoking rsync:
    - host1 and host2 have files C,E removed and A,B,D updated
    Is there an rsync switch supporting this?

    As I have not found such a switch I'm using the script at the end of
    this mail - which seems to work fine (provided that the created file
    'syncedfiles.local' is available).
    Any obvious problems?

    Best regards,
    Christian Schneider

    -- skript following --

    #!/bin/bash
    NAME=username
    DIR=/home
    REMOTE=username@host::home

    echo "*** delete files at remote side that were deleted locally (since
    last find) ***"
    #ATTENTION: this deletes even modified files on the remote side!
    rsync -rtzogpu --progress --exclude="syncedfiles.*"
    --include-from=syncedfiles.local --filter "- **" --delete
    --modify-window=1 --existing $DIR/$NAME $REMOTE

    echo
    echo "*** delete files at local side that were deleted remotely (since
    last find) ***"
    #ATTENTION: this deletes even modified files on the local side!
    rsync -rtzogpu --progress --exclude="syncedfiles.*"
    --include-from=syncedfiles.local --filter "- **" --delete
    --modify-window=1 --existing $REMOTE $DIR

    echo
    echo "*** copy new file to remote side ***"
    rsync -rtzogpu --progress --exclude="syncedfiles.*" --filter "+ **"
    --modify-window=1 $DIR/$NAME $REMOTE

    echo
    echo "*** copy new file from remote side ***"
    rsync -rtzogpu --progress --exclude="syncedfiles.*" --filter "+ **"
    --modify-window=1 $REMOTE $DIR

    cd $DIR
    find ./$NAME | sed -e 's/^.//' | grep -v syncedfiles > syncedfiles.local
    --
    To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
    Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

  2. Re: rsync when working on both sides...

    Christian Schneider wrote:
    > I want to use rsync to synchronize home directories on two PCs. It works
    > fine if I start rsync after working on a host each time I leave. But
    > instead of operating modes "host1 -> host2" and "host2 -> host1" I would
    > like to have a mode "host1 <-> host2" to allow synchronizing at any time
    > As I have not found such a switch I'm using the script at the end of
    > this mail - which seems to work fine (provided that the created file


    I made up a similar solution (in Python), see
    http://cmaf.fc.ul.pt/~barbaros -> english -> informatics
    It is not very easy to use, as I must call a script "register.py"
    in order to inform the system each time I modify a file.

    You may also want to take a look at
    http://www.foldermatch.com/fmcompetitors.htm

    Yours, Cristian Barbarosie
    http://cmaf.fc.ul.pt/~barbaros


+ Reply to Thread