Rsync

From Wikinico

Jump to: navigation, search

Contents

rsync

Useful options

  • --backup (-b)
make backups
  • --backup-dir=DIR
make backups into hierarchy based in DIR
  • --update (-u)
skip files that are newer on the receiver
  • --archive (-a)
archive mode; equals -rlptgoD (no -H,-A,-X)
  • --verbose (-v)
increase verbosity
  • --compress (-z)
compress file data during the transfer
  • --delay-updates
put all updated files into place at end

Command line

To update the Paris site (get the file from Nice)

#on a paris machine

#need an absolute path for the rsync command
setenv BACKUP /.../sega/.../backup/sync4

mkdir $BACKUP

setenv SRC nice_machine::/.../sega/.../root_of_sync
setenv DST /.../sega/.../root_of_sync

rsync -avz $SRC $DST --backup --backup-dir $BACKUP --update

Example

PARIS SITE

sega
|-- backup
`-- root_of_sync
    |-- character
    |   `-- sonic.ma
    `-- environment
        `-- house.ma
NICE SITE

sega
|-- backup
`-- root_of_sync
    |-- character
    |   |-- joe_musashi.ma
    |   `-- sonic.ma
    `-- environment
        `-- house.ma

Update of Paris site

sonic.ma is different and the Nice version is newer.

house.ma is the same or is newer on the Paris site.

Files in bold are changed or added:

PARIS SITE

sega
|-- backup
|   `-- sync1
|       `-- character
|           `-- sonic.ma   (from Paris)
`-- root_of_sync
    |-- character
    |   |-- joe_musashi.ma
    |   `-- sonic.ma   (from Nice)
    `-- environment
        `-- house.ma
NICE SITE

sega
|-- backup
`-- root_of_sync
    |-- character
    |   |-- joe_musashi.ma
    |   `-- sonic.ma
    `-- environment
        `-- house.ma

Additional data can be added in a file in the sync1 dir if needed.

Next sync at Paris will create a sync2 dir, ...

Restore overwritten files

If a file is overwritten in root_of_sync, it will be copied in backup before.

We could write of UI to dig into the backup syncs and restore an overwritten file if needed.

Personal tools