[Csync2] Partial path excludes?

Tony Muka tonymuka at gmail.com
Thu May 5 17:59:58 CEST 2011


Sorry to drag up this old message, but I didn't see much documentation
on this issue, and wanted to share my findings in trying to exclude
.svn folders with csync2.

After trying many failing variations of

exclude .svn
exclude .snv*
exclude .svn/*
exclude ".svn/*"
exclude *svn*

the only thing that worked was

exclude /var/www/*/htdocs/.svn/*;
exclude /var/www/*/htdocs/*/.svn/*;
exclude /var/www/*/htdocs/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/*/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/*/*/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/*/*/*/*/*/.svn/*;
exclude /var/www/*/htdocs/*/*/*/*/*/*/*/*/*/.svn/*;

It would really be nice if there was a way to use one simple rule to
exclude the descendants of any .svn folder, but for now, this works.

I probably don't have a good enough reason to exclude the .svn paths
to use this case as a justification for the feature, etc... Excluding
the .svn folders does cut my disk usage by 50% on the slave nodes.*

> -----Original Message-----
> From: csync2-bounces at lists.linbit.com [mailto:csync2-
> bounces at lists.linbit.com] On Behalf Of Marcus Bointon
>
> I have various hierarchies I want to sync, but there are some
> consistent patterns I want to exclude. From the docs it doesn't sound
> like I can exclude paths based on wildcards - I can either select
> explicit paths (/...), or partial filenames (*.php), but not partial
> paths (somedir/*). The particular case I have is for compiled Smarty
> templates - essentially anything inside a 'templates_c' directory
> (anywhere in the hierarchy, and there may be lots that I don't want to
> have to specify manually) should be ignored. In rsync I do --
> exclude="templates_c/*". I've tried:
>
> exclude templates_c/*
>
> but it didn't work (it still synced their contents). How can I do this
> in csync2?

I have something like that in my csync2.cfg:

	exclude /the_base_path_to_my_sites/*/home/www/views_c/*;

It works. However, my case is quite easy: the '/*/' never contains paths but
always a single dir (say, '/domain.tld/'). I don't know if the '/*/' "thing"
matches against a path (say, '/this/is/a/customer/path/'), but I think it
doesn't...

In this case, however, you may try to evince a few patterns in the paths you
want to exclude, then exclude each of them. Another way could be to
regularly use some external tool (like a script invoking 'find', in example)
to discover the paths containing a 'views_c' or 'template_c' directory, then
automatically add to csync2.cfg an exclude directive for each of these path
and, finally, csync the csync2.cfg file (this is important: csync2 mail fail
otherwise!).

Please also note that excluding a dir in a path may impede synchronizing the
removal of the whole path, because the path will not be empty in the target
system. So, if you want also to sync the removal of a site, the better thing
is to avoid 'exclude' in that path. By the way, the kind of exclusion you
want to do is probably due more to improving synch speed than to a real
need, isn't it? It may be worth avoiding this optimization if you prefer to
limit manual adjustments at a minimum.

Giampaolo


>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Creators of http://www.smartmessages.net/
> UK resellers of info at hand CRM solutions
> marcus at synchromedia.co.uk | http://www.synchromedia.co.uk/
>


More information about the Csync2 mailing list