rdiff-backup
Because the source server runs an older version of rsync, rdiff-backup cannot run directly. So we rsync to the destination server first then run rdiff-backup over the local copy. Also, because its a production server, we limit the outgoing speed so as not to compromise the server's ability to serve.
rossetti@Wakatipu:~$ cat /media/backup/backup-pukohu.sh
#!/bin/bash
SOURCE=laudanum-backup DEST=/media/backup/pukohu DESTR=/media/backup/pukohu-rdiff-backup
EXCLUDE=/media/backup/backup-pukohu-exclude.txt LIMIT=100 # speed limit in kbps RSYNC=/usr/bin/rsync RDIFF=/usr/bin/rdiff-backup
cd $DEST
$RSYNC -avvz --delete --delete-excluded --numeric-ids --bwlimit=$LIMIT --exclude-from=$EXCLUDE $SOURCE:/ ./
$RDIFF $DEST $DESTR
$RDIFF --list-increment-sizes $DESTR | mail mr.snow@ww2.houseoflaudanum.com -s "Pukohu backup complete"
Exchange keys to allow automatic login.
rossetti@pukohu:~$ sudo cat /root/.ssh/authorized_keys2
command="rsync --server --sender -vvlogDtprz --bwlimit=100 --numeric-ids . / ",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa [my-long-rsa-key] == backup@Wakatipu
Configure cron job on the destination server as the `backup` user.
rossetti@Wakatipu:~$ sudo -u backup crontab -e
# m h dom mon dow command 10 2 * * * /media/backup/backup-pukohu.sh >> /media/backup/backup-pukohu.log