trying to get incremental backups working

John Mearns johnm at psi.pair.com
Wed Apr 23 13:14:59 EST 2003


So I'm trying to write up a short script to do some backups over rsync.
The goal is to have multiple client machines push the backups to the
backup server nightly. The backup server will have a complete copy of the
selected directories as well as revisions for the last 7 days.
Here is the brief script I have. Btw if you're wondering about all the
variables, I eventually want to set it to pull the values for them from a
conf file that others will edit through a web interface.

BACKUPDIR=`date +%A`
BACKUPHOST=wally
REMOTEUSER=root
ARCHBASE=/home/catbertbackup/backuparchive/
CURRENT=current
INCLUDEFILE=/usr/local/etc/backup2/include
EXCLUDEFILE=
rsync --delete --backup --backup-dir=$ARCHBASE$BACKUPDIR -ae ssh
/usr/local/etc $REMOTEUSER@$BACKUPHOST:$ARCHBASE$CURRENT
rsync --delete --backup --backup-dir=$ARCHBASE$BACKUPDIR -ae ssh
/etc $REMOTEUSER@$BACKUPHOST:$ARCHBASE$CURRENT

Right now this does pretty much what I would like. I need to do multiple
directories though. What is the best way for me to make this do say
/usr/local/etc /etc and /home? I've tried a few different things and
nothing has come out too well yet. Ideally I'd like all of the backed up
directories under /home/catbertbackup/backuparchive/current/etc and
/home/catbertbackup/backuparchive/Tuesday/etc but also have
/home/catbertbackup/backuparchive/current/usr/local/etc

Because I have to use the --delete flag though I'm having trouble doing
that. For instance with the script it will sync /usr/local/etc, then
sync /etc and delete /usr/local/etc.  Any suggestions on how to do
this and wind up with all the backups in one directory would be quite
appreciated!

Thanks,
John



More information about the rsync mailing list