rsync with overlay tree
tomr
tom at equalit.ie
Thu Mar 31 04:40:55 UTC 2016
I maintain a directory structure containing dirs and files that I regularly push to ~50 hosts, which are divided into 3 groups that have slightly different needs (minor mods in a couple of files).
So ideally I would have 4 directories:
/path/to/sync/common/ <- common files
/path/to/sync/group1/ <- group1 specific only
/path/to/sync/group2/ <- group2 specific only
/path/to/sync/group3/ <- group3 specific only
Then I'd run an rsync like:
rsync -av --overlay /path/to/sync/groupN \
/path/to/sync/common remotehost:
Thinking in terms of a list of files to be transferred, I would like:
- Anything present in common/ added to the file list; then
- Anything present in groupN/ added to the list, clobbering if applicable (regardless of mtime)
- The destination directory to show no sign of the common / overlay structure
I suspect I could populate the list myself and use '--files-from=<LIST>' but I would rather have rsync work it out if possible. If all else fails, I will do the merge locally first.
TEMPDIR=$(mktemp -d)
cp -r /path/to/sync/common/* $TEMPDIR
cp -r /path/to/sync/groupN/* $TEMPDIR
rsync -av $TEMPDIR/* remotehost:
rm -r $TEMPDIR
Thanks in advance,
tom
More information about the rsync
mailing list