rsync incremental backup problem with --backup-dir switch

Don van der Haghen Don at
Wed Apr 9 00:56:42 EST 2003


I am using rsync v2.5.6 to backup our entire server filesystem over the
network to a central backup server.
I have copied the example script from the rsync website
( to create incremental backups, the
--backup-dir seems to have a strange side-effect.

Everything goes well, but on the server side where the backup is stored I
can't seem to break out of the $BSERVER::$USER/current directory with e.g.
the --backup-dir=/Monday switch. Which results in the directories being
endlessly moved into eachother, like this:
Instead, the moved files should be located in /backup/rtr-heijen/Monday
and not /backup/rtr-heijen/current/Monday

I have read all documentation and examples I could find in order to find a
solution, but I could not find any. Either I am missing something here,
the example on the website is incorrect or some bug has gotten into rsync.

Here is the script I am using, with some irrelevant pieces/comments stripped:
cd /
# directory to backup
# Override the user
# excludes file (Works well)
# the name of the backup machine
# your password on the backup server
export RSYNC_PASSWORD=SomePassword
BACKUPDIR=`date +%A` # Results in 'Monday', 'Tuesday', etc.
# Maybe some mistake here
OPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES
      --delete --backup --backup-dir=/$BACKUPDIR -a"
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
# the following line clears the last weeks incremental directory
[ -d $HOME/emptydir ] || mkdir $HOME/emptydir
/usr/bin/rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/
rmdir $HOME/emptydir
# now the actual transfer
rsync $OPTS $BDIR $BSERVER::$USER/current

Thanks in advance for any help you can provide me with.

Yours sincerely,

Don van der Haghen
don at

More information about the rsync mailing list