more on selective deletion

Lucio Chiappetti lucio at mi.iasf.cnr.it
Thu Oct 3 16:37:00 EST 2002


I am trying to arrange a mirroring of two trees which will be arranged
like this :

   --- top --- .htaccess                                a
           --- a number of log files                    a
           +-- Files --- contains local stuff           b
           +-- dir1  --- files                          c
           +-- dir2  --- files                          c
           |
           +-- dirn  --- files                          c

The files indicated as "a" will be local of either site, they won't need
to be mirrored but shall be left alone on each site

The directory indicated as "b" with its content exists only on the master
site and won't need to be mirrored

The directories indicated as "c" (and relevant subdirectories), once
created or deleted on the master site, must be created or deleted on the
mirror, but the files contained in them shall not be mirrored (and each
site can have different files).

The idea is that the directories are user names and groups managed at the
master site, while the content are scratch files created by the users at
whichever site they would connect.

Therefore the directories shall be present at all sites.
The files created in them shall not be mirrored nor deleted

Once a directory is empty on the master site, then they (and their
content) should be deleted on the mirror.

The definition of the module in the rsyncd config file on the master
has the line

exclude=- *.log - .htaccess - /Files + /**/ - *

The rsync invocation on the mirror to pull the update is

rsync -rlptzu --delete --include='*/' --exclude='*' origin destination

With this locally created files are left intact
Directories created on the master are propagated
Files created on the master are not propagated
Files created locally are not deleted
Directories emptied and deleted on the master are deleted insofar they
are empty on the mirror
Directories emptied and deleted on the master but with local files
on the mirror are not deleted.

They are actually not even considered for deletion because the relevant
files are "excluded because of pattern *" (hence the --force option won't
help ...

... on the other hand the --delete-excluded option would remove both local
files created in directories no longer existing as well as those in
legitimate directories !

I must also confess I am rather confused about when include and exclude
options have to go in the config file on the server, and when also on
the runstring on the client (destination).

Is there a smart way of doing what I want ?

In principle I could decide to remove periodically files unaccessed since
n days (via crontab, independently on each site). This will make things
right after a few days. But I'd prefer a "rsync-only" solution

----------------------------------------------------------------------------
Lucio Chiappetti - IASF/CNR - via Bassini 15 - I-20133 Milano (Italy)
----------------------------------------------------------------------------
Fuscim donca de Miragn        E tornem a sta scio' in Bregn
Che i fachign e i cortesagn   Magl' insema no stagn begn
Drizza la', compa' Tapogn                            (Rabisch, II 41, 96-99)
----------------------------------------------------------------------------
For more info : http://www.mi.iasf.cnr.it/~lucio/personal.html
----------------------------------------------------------------------------




More information about the rsync mailing list