Folgendes -
ich versuche krampfhaft ein Skript zusammenzubasteln, welches
mir mittels rsync die gewünschten Verzeichnisse kopiert.
Das kommando ist an sich einfach
Code: Select all
rsync -avz --exlude-from="/etc/rsync-excludes" / /backup
Code: Select all
/data
/opt/
/tmp/
/var/run/
Das Problem ist folgendes: im Ordner "/data", der ja excludet wird,
ist neuerdings ein Ordner, denn ich gern als Kopie haben will.
Ich dachte mir, ich legen dann halt eine zweite Datei "/etc/rsync-includes"
an, und trage dort folgendes ein:
Code: Select all
/data/der-gute-stoff/
Letzten Endes also
Code: Select all
rsync -avz --exlude-from="/etc/rsync-excludes" --include-from="/etc/rsync-includes" / /backup/
Klappt aber nicht.
Habe auch zum Teil herausgefunden woran's liegt - in dem Moment wo
die komplette Liste der zu kopierenden Daten gemacht wird, wird
mein gewünschter ordner "/data/der-gute-stoff/" mit der EXCLUDE-Regel des "/data" quasi überschrieben und deswegen nicht mitkopiert.
Ich habe schon die "man rsync" gründlich studiert, aber die Erklärungen dort
sind irgenwie nicht eindeutig.
Z.B. wird folgendes gesagt:
Code: Select all
Note that, when using the --recursive (-r) option (which is implied by
-a), every subcomponent of every path is visited from the top down, so
include/exclude patterns get applied recursively to each subcomponent’s
full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and
"/foo/bar" must not be excluded). The exclude patterns actually short-
circuit the directory traversal stage when rsync finds the files to
send. If a pattern excludes a particular parent directory, it can renâ€
der a deeper include pattern ineffectual because rsync did not descend
through that excluded section of the hierarchy. This is particularly
important when using a trailing ’*’ rule. For instance, this won’t
work:
+ /some/path/this-file-will-not-be-found
+ /file-is-included
- *
This fails because the parent directory "some" is excluded by the ’*’
rule, so rsync never visits any of the files in the "some" or
"some/path" directories. One solution is to ask for all directories in
the hierarchy to be included by using a single rule: "+ */" (put it
somewhere before the "- *" rule), and perhaps use the
--prune-empty-dirs option. Another solution is to add specific include
rules for all the parent dirs that need to be visited. For instance,
this set of rules works fine:
+ /some/
+ /some/path/
+ /some/path/this-file-is-found
+ /file-also-included
- *
Ich werde einfach nicht schlau daraus...
Kann einer da helfen?
Danke für eure Mühe!