rdiff-backup is a nice tool for backups, I made a small script which is executed by cron.daily to backup my boxes:

#!/bin/bash

# install this file to /usr/local/sbin/rdiff-backup.daily

#Server Configuration:
# /etc/rdiff-backup.conf
#  BACKUPDIR=local location where to place the backups
#  MAXAGE=default age for backups
#
# /etc/rdiff-backup.hosts 
# lines containing:
#  <name> <location> <age>
#   name is the name appended to $BACKUPDIR and use to identify the backup
#   location is a rdiff-backup format description of the source location
#   age is optional and gives the time for how long backups are kept else $MAXAGE is taken as default
#   a leading # disables the line (comment)
#
# /etc/rdiff-backup.inc.$name 
#  rdiff-backup formatted include-globlist used when backung up $name

#Client Configuration:
# following paths are searched for global include-globlists
#  /rdiff-backup.inc
#  /.rdiff-backup.inc
#  /etc/rdiff-backup.inc
#
# following parts are searched for local include-globlists (apply only to subdirs)
#  /home/*/.rdiff-backup.inc
#  /home/*/*/.rdiff-backup.inc

if test -f /etc/rdiff-backup.conf; then
        source /etc/rdiff-backup.conf
else
        echo "missing /etc/rdiff-backup.conf"
        exit 125
fi

source ssh-cron-agent

cat /etc/rdiff-backup.hosts |\
while read name location maxage; do

        if test "$1" && test "$1" != "$name"; then
                continue
        fi

        test "${name:0:1}" = '#' && continue 

        echo "Backing up $name from $location"

        TMP=$(tempfile)

        nice rdiff-backup --check-destination-dir $BACKUPDIR/$name/

        (
                echo "- $BACKUPDIR"
                echo "+ /rdiff-backup.inc"
                echo "+ /.rdiff-backup.inc"
                echo "+ /etc/rdiff-backup.inc"
                echo "+ /home/*/.rdiff-backup.inc"
                echo "+ /home/*/*/.rdiff-backup.inc"

                test -f "/etc/rdiff-backup.inc.$name" && cat "/etc/rdiff-backup.inc.$name"
                test -f "$BACKUPDIR/$name/rdiff-backup.inc" && cat "$BACKUPDIR/$name/rdiff-backup.inc"
                test -f "$BACKUPDIR/$name/.rdiff-backup.inc" && cat "$BACKUPDIR/$name/.rdiff-backup.inc"
                test -f "$BACKUPDIR/$name/etc/rdiff-backup.inc" && cat "$BACKUPDIR/$name/etc/rdiff-backup.inc"
                for i in $BACKUPDIR/$name/home/*/.rdiff-backup.inc; do
                        test "$i" = "$BACKUPDIR/$name/home/*/.rdiff-backup.inc" && break
                        dirname="$(dirname $i)"
                        dirname="${dirname#$BACKUPDIR/$name}"
                        sed -e 's|^\([+-] \)\?\(.\+\)$|\1'${dirname}'/\2|' -e '/^$/d' -e '/\.\./d' <$i
                done
                for i in $BACKUPDIR/$name/home/*/*/.rdiff-backup.inc; do
                        test "$i" = "$BACKUPDIR/$name/home/*/*/.rdiff-backup.inc" && break
                        dirname="$(dirname $i)"
                        dirname="${dirname#$BACKUPDIR/$name}"
                        sed -e 's|^\([+-] \)\?\(.\+\)$|\1'${dirname}'/\2|' -e '/^$/d' -e '/\.\./d' <$i
                done
        ) >$TMP

        nice rdiff-backup -b --include-globbing-filelist $TMP --exclude '*' $location $BACKUPDIR/$name/

        if test $? = '0'; then
                nice rdiff-backup --remove-older-than ${maxage:-$MAXAGE} --force $BACKUPDIR/$name/
        fi

        nice rdiff-backup --list-increments $BACKUPDIR/$name/

        rm $TMP
done
rdiff-backup.daily

You likely want the ssh-cron-agent too.

Example Configuration file on the Backup server

The global configuration /etc/rdiff-backup.conf

BACKUPDIR=/data/safe/backups/hosts
MAXAGE=1M
source /usr/local/bin/ssh-cron-agent

the configuration which hosts shall be backed up /etc/rdiff-backup.hosts

starbase / 5M
mercur mercur.localnet::/ 5M
fluff fluff.localnet::/ 7M

Include file examples for the machines backed up

the global /etc/rdiff-backup.inc:

+ /etc/**
+ /boot/**
+ /var/bzr/**
+ /var/backups/**
+ /var/lib/**
+ /usr/**

and a users private includefile ~/.rdiff-backup.inc:

+ src/**
+ .secos/**
+ .gnupg/**
+ .ssh/**
- .mozilla/**/Cache**
- mnt/**
+ .mozilla/**
+ .mozilla-thunderbird/**

BackupTools (last edited 2007-11-09 00:04:21 by ct)