Rsync

From Alessandro's Wiki
Jump to: navigation, search
  • some options
  1. -x one filesystem
  2. -X xattr
  3. -z compress
  4. -H preserve hard links
  5. -c checksum
  6. --delete remove deleted files from destination
  7. --delete-excluded


  • sync a directory, deleting deleted files from destination
rsync --progress --delete -avP srv::home /mnt/mirror/home/
#!/bin/sh

date=`date "+%Y-%m-%dT%H_%M_%S"`
HOME=/home/user/

rsync -azP \
  --delete \
  --delete-excluded \
  --exclude-from=$HOME/.rsync/exclude \
  --link-dest=../current \
  $HOME user@backupserver:Backups/incomplete_back-$date \
  && ssh user@backupserver \
  "mv Backups/incomplete_back-$date Backups/back-$date \
  && rm -f Backups/current \
  && ln -s back-$date Backups/current"