Hi everybody, I want to share a feature request I wrote here some time ago. I'd like to give rsync more than 1 source-tree, where the "sum" (as described below) is rsync'd to the destination. suppose I have some machines, which have almost the same configuration, different only in small details. Then I want to rsync all machines from a master, with the details as specific to every machine. I propose the following mechanism: - the commandline is parsed as now, but instead of a single source name an array of source names is saved. - on reading the source directories the first ("master") directory is read (as now). - then the rest of the source directories is read, and every file there which is already in memory is discarded. So only additional files are added to memory. and ->basedir now points to the correct source directory. so given this example BASE/ a b c 1/ d e 2/ d e if I run rsync BASE --source 1 machine1:destination the trees BASE and 1 are taken and rsync'd to machine1. Another simple extension to this is to give a list of filenames (or a file with a list of filenames) as parameter, and every file in this list is not substituted but APPENDED. So I could have a base /etc/passwd and another with the user accounts in the different version directories and have them pushed together to the other machine! Here a bitfield saying in which trees the file is present would be good. If no-one else starts working on that I'll do my worst - but it can take some time. Comments, please??? Regards, Phil
Hi everybody, I want to share a feature request I wrote here some time ago. I'd like to give rsync more than 1 source-tree, where the "sum" (as described below) is rsync'd to the destination. suppose I have some machines, which have almost the same configuration, different only in small details. Then I want to rsync all machines from a master, with the details as specific to every machine. I propose the following mechanism: - the commandline is parsed as now, but instead of a single source name an array of source names is saved. - on reading the source directories the first ("master") directory is read (as now). - then the rest of the source directories is read, and every file there which is already in memory is discarded. So only additional files are added to memory. and ->basedir now points to the correct source directory. so given this example BASE/ a b c 1/ d e 2/ d e if I run rsync BASE --source 1 machine1:destination the trees BASE and 1 are taken and rsync'd to machine1. Another simple extension to this is to give a list of filenames (or a file with a list of filenames) as parameter, and every file in this list is not substituted but APPENDED. So I could have a base /etc/passwd and another with the user accounts in the different version directories and have them pushed together to the other machine! Here a bitfield saying in which trees the file is present would be good. If no-one else starts working on that I'll do my worst - but it can take some time. Comments, please??? Regards, Phil
He's wanting rsync to interleave the directories, automatically resolving any conflicts, not put multiple directories under the destination. At least, that's what he seems to be asking. Tim Conway tim.conway@philips.com 303.682.4917 Philips Semiconductor - Longmont TC 1880 Industrial Circle, Suite D Longmont, CO 80501 Available via SameTime Connect within Philips, n9hmg on AIM perl -e 'print pack(nnnnnnnnnnnn, 19061,29556,8289,28271,29800,25970,8304,25970,27680,26721,25451,25970), ".\n" ' "There are some who call me.... Tim?" Dave Dykstra <dwd@bell-labs.co To: "Ph. Marek" <marek@bmlv.gv.at> m> cc: rsync@lists.samba.org Sent by: (bcc: Tim Conway/LMT/SC/PHILIPS) rsync-admin@lists Subject: Re: Feature req: multiple source trees .samba.org Classification: 10/24/2001 11:09 AM How is that different from the behavior now when multiple source directories are given? The rsync Usage says: Usage: rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST or rsync [OPTION]... [USER@]HOST:SRC DEST or rsync [OPTION]... SRC [SRC]... DEST or rsync [OPTION]... [USER@]HOST::SRC [DEST] or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST] SRC on single-colon remote HOST will be expanded by remote shell SRC on server remote HOST may contain shell wildcards or multiple sources separated by space as long as they have same top-level Multiple sources can be specified in all cases. - Dave Dykstra On Wed, Oct 24, 2001 at 11:19:01AM +0200, Ph. Marek wrote:> Hi everybody, > > I want to share a feature request I wrote here some time ago. > > > I'd like to give rsync more than 1 source-tree, where the "sum" (as > described below) is rsync'd to the destination. > > suppose I have some machines, which have almost the same configuration, > different only in small details. > Then I want to rsync all machines from a master, with the details as > specific to every machine. > > I propose the following mechanism: > > - the commandline is parsed as now, but instead of a single source name an > array of source names is saved. > - on reading the source directories the first ("master") directory is read > (as now). > - then the rest of the source directories is read, and every file there > which is already in memory is discarded. So only additional files are added > to memory. and ->basedir now points to the correct source directory. > > so given this example > > BASE/ > a > b > c > 1/ > d > e > 2/ > d > e > > if I run rsync BASE --source 1 machine1:destination > the trees BASE and 1 are taken and rsync'd to machine1. > > > Another simple extension to this is to give a list of filenames (or a file > with a list of filenames) as parameter, and every file in this list is not > substituted but APPENDED. > So I could have a base /etc/passwd and another with the user accounts in > the different version directories and have them pushed together to the > other machine! Here a bitfield saying in which trees the file is present > would be good. > > > If no-one else starts working on that I'll do my worst - but it can take > some time. > > > Comments, please??? > > > Regards, > > Phil > >
On Thu, Oct 25, 2001 at 07:07:26AM +0200, Ph. Marek wrote [in private email]:> >How is that different from the behavior now when multiple source > >directories are given? The rsync Usage says: > > > > Usage: rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST > > or rsync [OPTION]... [USER@]HOST:SRC DEST > > or rsync [OPTION]... SRC [SRC]... DEST > > or rsync [OPTION]... [USER@]HOST::SRC [DEST] > > or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST > > or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST] > > SRC on single-colon remote HOST will be expanded by remote shell > > SRC on server remote HOST may contain shell wildcards or multiple > > sources separated by space as long as they have same top-level > > > >Multiple sources can be specified in all cases. > but these sources are independent, right? > > if I "rsync A B C host:/target" I get host:/target/A, host:/target/B and > host:/target/C. > I'd like to get (given the data A/a, A/b, B/b, B/c and C/d) > host:/target/a, host:/target/b (from directory B as it "overrides" A), > host:/target/c and host:/target/d. > > I know that this can be done using 3 rsync-statements (one for A, B and C), > but I think this is horrible inefficient as Files which are in B or C but > not in A get deleted everytime and recreated. > > Is that better explained??If you add a slash to the end of each source path, they will get merged into the target: rsync -a A/ B/ C/ host:/target Rsync always adds the base directory component of the source path to the destination path if you don't end the source path in a slash. - Dave Dykstra