Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Rsnapshot passes excludes directly to rsync, but rsync's behavior appears inconsistent.

I've simplified my rsnapshot backup test to the following directory tree (this tree will be backed up):

gorilla:~# find /tmp/snaptest -exec file {} \;
/tmp/snaptest: directory
/tmp/snaptest/SKIPTHIS: directory
/tmp/snaptest/SKIPTHIS/xyz: directory
/tmp/snaptest/SKIPTHIS/xyz/testing: ASCII text
/tmp/snaptest/SKIPTHIS/bar: ASCII text
/tmp/snaptest/SKIPTHIS/foo: ASCII text
/tmp/snaptest/SKIPTHIS.txt: ASCII text

My config file:

config_version  1.2
snapshot_root   /tmp/backup-media
no_create_root  1
cmd_cp  	/bin/cp
cmd_rm  	/bin/rm
cmd_rsync   /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger  /usr/bin/logger
cmd_du  	/usr/bin/du
interval    hourly	6
interval    daily	7
interval    weekly	4
interval    monthly	3
verbose 	3
loglevel    3
logfile /media/maxtor-one-touch/rsnapshot.log
lockfile    /media/maxtor-one-touch/backups/
rsync_short_args    -a
rsync_long_args --delete --numeric-ids --relative --delete-excluded
exclude "SKIPTHIS/**"
link_dest   1
backup  /tmp/snaptest	snaptest

The result:

gorilla:~# rsnapshot -c /tmp/snaptest.conf hourly
echo 12638 > /media/maxtor-one-touch/backups/ 
mkdir -m 0755 -p /tmp/backup-media/hourly.0/ 
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded \
    --exclude="SKIPTHIS/**" /tmp/snaptest \
touch /tmp/backup-media/hourly.0/ 
rm -f /media/maxtor-one-touch/backups/ 
gorilla:~# find /tmp/backup-media/ -exec file {} \;
/tmp/backup-media/: directory
/tmp/backup-media/hourly.0: directory
/tmp/backup-media/hourly.0/snaptest: directory
/tmp/backup-media/hourly.0/snaptest/tmp: sticky directory
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest: directory
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest/SKIPTHIS: directory
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest/SKIPTHIS/xyz: directory
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest/SKIPTHIS/xyz/testing: ASCII text
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest/SKIPTHIS/bar: ASCII text
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest/SKIPTHIS/foo: ASCII text
/tmp/backup-media/hourly.0/snaptest/tmp/snaptest/SKIPTHIS.txt: ASCII text

My confusion stems from the fact that if I copy-paste the rsync command echoed by rsnapshot, the SKIPTHIS directory is excluded! (I've tested with various other SKIPTHIS patterns with the same results.)

Any idea what's going on?

share|improve this question
up vote 3 down vote accepted

Turning rsync verbosity way up shows the problem:

rsync_short_args    -avvv


[client] add_rule(-s "SKIPTHIS/")

Whereas when I was copy-pasting into the shell, the shell was consuming the quotes and rsync said:

[client] add_rule(-s SKIPTHIS/)

Changing the exclude rule in my config file to:

exclude SKIPTHIS/**


share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .