On Wed, 23 Feb 2005, Danny Sauer <rsync@danny.teleologic.net>
wrote:>
> So, given this (broken up for email - it's all one line in the
> script):
>
> /usr/bin/rsync -q -a -e ssh -H --delete --delete-excluded
> --ignore-errors --include "/" --exclude "/proc/*"
> --exclude "/proc/bus/usb/*" --include "/boot/*"
> --exclude "/dev/pts/*" --exclude "/dev/shm/*"
> --exclude '/tmp/*' --exclude '/var/tmp/*'
> --exclude '/usr/tmp/*' --exclude '/var/cache/*'
> --exclude '*~'
> root@router:/ /mnt/backup/router
>
> Why do I have this:
>
> gutenberg backup # ls -l /mnt/backup/router/proc | head -n 10
> total 140634
> dr-xr-xr-x 3 root root 336 Feb 23 11:18 1
> dr-xr-xr-x 3 root root 312 Feb 23 11:18 10
> dr-xr-xr-x 3 501 501 336 Feb 23 11:18 1059
> dr-xr-xr-x 3 root root 312 Feb 23 11:18 11
> dr-xr-xr-x 3 postfix postfix 336 Feb 23 11:18 1448
> dr-xr-xr-x 3 root root 312 Feb 23 11:18 15
> dr-xr-xr-x 3 root root 336 Feb 23 11:18 1607
> dr-xr-xr-x 3 root root 336 Feb 23 11:18 1609
> dr-xr-xr-x 3 root root 312 Feb 23 11:18 2
>
> I've clearly listed --exclude "/proc/*" and
--delete-excluded, but
> there's still stuff in /proc. I've tried
--exclude="/proc" and
> --exclude "/proc/" - but friggin' /proc is getting copied
every time.
> None of the other excludes seem to be followed either - which is a
> royal pain. Is it the order (or the --include /)? What's the
> precedence of --include and --exclude?
There is no precedence. The patterns are tested in the order in which
the options are specified. The first pattern to match determines the
action based on its associated include/exclude option.
The --include "/" is superfluous - including the top-level dirctory is
the default initial rule. I've never seen anyone using this...
Have you tried the rsync without it? The "/" could be interpreted in
two ways - as the explicit top-level root directory, or as a trailing
slash on a null directory, which rsync might treat the same as a "*/".
That means include all directories, which would cause the problem that
you are experiencing.
What version of rsync are you using, btw?
--
John Van Essen Univ of Minn. Alumnus <vanes002@umn.edu>