Brian K. White
brian at aljex.com
Mon Nov 21 13:09:11 MST 2011
On 11/19/2011 9:04 AM, Francis.Montagnac at inria.fr wrote:
> On Tue, 15 Nov 2011 23:49:18 +0100 "Brian K. White" wrote:
>> nj2:/opt/x # rsync -avvvn --force --delete --include=/tmp
>> --include=floof/ --exclude='*' /tmp/. co4::root/tmp/.
> Detail: /tmp being the "root of the transfer", "--include=/tmp" is
> wrong because it refers then to /tmp/tmp.
> I thing you can do what you want by using a risk filter rule instead
> of an include one.
> rsync -avvvn --force --delete \
> --filter='R /floof/***' --exclude='*' \
> /tmp/. co4::root/tmp/.
> This should remove recursively co4::root/tmp/floof without browsing
> integrally /tmp nor co4::root/tmp.
root of the transfer is always "/"
Call it bad policy if you want but the way I'm managing a collection of
more or less cookie cutter boxes is, all boxes have a rsync daemon
running, and /etc/rsyncd.conf includes:
uid = root
gid = sys
read only = false
use chroot = true
numeric ids = false
munge symlinks = false
transfer logging = true
log format = %h %o %f %l %b
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
#hosts allow = trusted.hosts
secrets file = /etc/rsyncd.secrets
path = /
auth users = root
so, while logged in as root on the devel box or any other box I can
rsync -avz /path/to/src host::root/path/to
rsync -avz host::root/path/to/src /path/to
And this script relies on that to make it basically brainless for the
developers to be able to say:
pushfile /path/to/thing host
and /path/to/thing is replicated from devel to all production boxes, or
from whatever box the developer is on, to "host"
without actually knowing any rsync syntax or remembering to include
"thing" in the source and remove "thing" from the destination etc, the
script does that.
I don't have a specific question with this email, just clarifying the
context and what's actually going on. I had to put the "add a delete
option" project aside for a few days, so it does not work, but I still
have things I haven't tried so that's only normal and I'm not asking for
any more help until I have done my own homework first.
Actually my first idea of doing a reverse sync with the --remove-files
option set, and then just deleting the local copy that gets pulled down,
that actually worked, it was just less efficient than ideal.
More information about the rsync