vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Need some help from scripting Guru. server A and B has the same directory structure, so I need to copy all new modified files to correstponding directory in Sever B. I can use "find" command to locate those file and direcotries into a file, but how can I copy over. I need some assisstance for this. Thanks in advance |
| |||
| Words to the wise, "steeles" <steeles@gmail.com> wrote: >Need some help from scripting Guru. > >server A and B has the same directory structure, so I need to copy all new >modified files to correstponding directory in Sever B. > >I can use "find" command to locate those file and direcotries into a file, >but how can I copy over. > >I need some assisstance for this. First thing which comes to mind is setting up sftp - in batch mode - with ssh keys in order not to need authentification Second thing which comes to mind is using rsync. -- Claus Dragon <clauskick@mpsahotmail.com> =(UDIC)= d++ e++ T-- K1!2!3!456!7!S a27 "Coffee is a mocker. So, I am going to mock." - Me, lately. |
| |||
| Thanks. rsync is an open source tool similar to rcp Orignially I want to use "Find", but how can I copy those files into same direcotry in sever B? "CK" <claus@ultima-dragons.org> wrote in message news:hrnv93lp64uji9k6ib0mh9fj15jnjqsln1@4ax.com... > Words to the wise, "steeles" <steeles@gmail.com> wrote: > >>Need some help from scripting Guru. >> >>server A and B has the same directory structure, so I need to copy all new >>modified files to correstponding directory in Sever B. >> >>I can use "find" command to locate those file and direcotries into a file, >>but how can I copy over. >> >>I need some assisstance for this. > > First thing which comes to mind is setting up sftp > > - in batch mode > - with ssh keys in order not to need authentification > > Second thing which comes to mind is using rsync. > -- > Claus Dragon <clauskick@mpsahotmail.com> > =(UDIC)= > d++ e++ T-- > K1!2!3!456!7!S a27 > "Coffee is a mocker. So, I am going to mock." > > - Me, lately. |
| |||
| steeles wrote: > Thanks. > > rsync is an open source tool similar to rcp > > Orignially I want to use "Find", but how can I copy those files into same > direcotry in sever B? > > > "CK" <claus@ultima-dragons.org> wrote in message > news:hrnv93lp64uji9k6ib0mh9fj15jnjqsln1@4ax.com... >> Words to the wise, "steeles" <steeles@gmail.com> wrote: >> >>> Need some help from scripting Guru. >>> >>> server A and B has the same directory structure, so I need to copy all new >>> modified files to correstponding directory in Sever B. >>> >>> I can use "find" command to locate those file and direcotries into a file, >>> but how can I copy over. >>> >>> I need some assisstance for this. >> First thing which comes to mind is setting up sftp >> >> - in batch mode >> - with ssh keys in order not to need authentification >> >> Second thing which comes to mind is using rsync. >> -- >> Claus Dragon <clauskick@mpsahotmail.com> >> =(UDIC)= >> d++ e++ T-- >> K1!2!3!456!7!S a27 >> "Coffee is a mocker. So, I am going to mock." >> >> - Me, lately. > > Assuming you have it set up so that you can ssh from server A to server B without giving a password, you can use rsync --rsh=ssh --archive --delete /home/dir/ serverB:/home/dir The trailing slash on the first directory entry is necessary. This command will keep the directory structure on server B exactly like what is on server A. No daemons on B need to be started up other than sshd. If you still like find, you could use find /home/dir -type f -exec scp {} serverB: \; but you'll have to watch out for oddball characters in file names and new directories on A will not be created on B. Doug |
| |||
| Thanks a lot. Is it good idea to rsync /etc/passwd and /etc/shadow, so server B and A can have the same users with password. I tried to cp "passwd" file to server B under /tmp, but seems "scp" didn't carry over the "group", it show "other" instead of "sys" # l /tmp/passwd -r--r--r-- 1 root other 25502 Jul 18 15:55 /tmp/passwd "Douglas O'Neal" <oneal@dbi.udel.edu> wrote in message news:f7qcvb$1ih$1@scrotar.nss.udel.edu... > steeles wrote: >> Thanks. >> >> rsync is an open source tool similar to rcp >> >> Orignially I want to use "Find", but how can I copy those files into same >> direcotry in sever B? >> >> >> "CK" <claus@ultima-dragons.org> wrote in message >> news:hrnv93lp64uji9k6ib0mh9fj15jnjqsln1@4ax.com... >>> Words to the wise, "steeles" <steeles@gmail.com> wrote: >>> >>>> Need some help from scripting Guru. >>>> >>>> server A and B has the same directory structure, so I need to copy all >>>> new >>>> modified files to correstponding directory in Sever B. >>>> >>>> I can use "find" command to locate those file and direcotries into a >>>> file, >>>> but how can I copy over. >>>> >>>> I need some assisstance for this. >>> First thing which comes to mind is setting up sftp >>> >>> - in batch mode >>> - with ssh keys in order not to need authentification >>> >>> Second thing which comes to mind is using rsync. >>> -- >>> Claus Dragon <clauskick@mpsahotmail.com> >>> =(UDIC)= >>> d++ e++ T-- >>> K1!2!3!456!7!S a27 >>> "Coffee is a mocker. So, I am going to mock." >>> >>> - Me, lately. >> >> > > Assuming you have it set up so that you can ssh from server A to > server B without giving a password, you can use > > rsync --rsh=ssh --archive --delete /home/dir/ serverB:/home/dir > > The trailing slash on the first directory entry is necessary. This > command will keep the directory structure on server B exactly like > what is on server A. No daemons on B need to be started up other > than sshd. > > If you still like find, you could use > > find /home/dir -type f -exec scp {} serverB: \; > > but you'll have to watch out for oddball characters in file names > and new directories on A will not be created on B. > > Doug |
| |||
| find /home/dir -type f -exec scp {} serverB: \; I tried, it, it acutally copy files into "/" in server B, not those files supposed to be. "Douglas O'Neal" <oneal@dbi.udel.edu> wrote in message news:f7qcvb$1ih$1@scrotar.nss.udel.edu... > steeles wrote: >> Thanks. >> >> rsync is an open source tool similar to rcp >> >> Orignially I want to use "Find", but how can I copy those files into same >> direcotry in sever B? >> >> >> "CK" <claus@ultima-dragons.org> wrote in message >> news:hrnv93lp64uji9k6ib0mh9fj15jnjqsln1@4ax.com... >>> Words to the wise, "steeles" <steeles@gmail.com> wrote: >>> >>>> Need some help from scripting Guru. >>>> >>>> server A and B has the same directory structure, so I need to copy all >>>> new >>>> modified files to correstponding directory in Sever B. >>>> >>>> I can use "find" command to locate those file and direcotries into a >>>> file, >>>> but how can I copy over. >>>> >>>> I need some assisstance for this. >>> First thing which comes to mind is setting up sftp >>> >>> - in batch mode >>> - with ssh keys in order not to need authentification >>> >>> Second thing which comes to mind is using rsync. >>> -- >>> Claus Dragon <clauskick@mpsahotmail.com> >>> =(UDIC)= >>> d++ e++ T-- >>> K1!2!3!456!7!S a27 >>> "Coffee is a mocker. So, I am going to mock." >>> >>> - Me, lately. >> >> > > Assuming you have it set up so that you can ssh from server A to > server B without giving a password, you can use > > rsync --rsh=ssh --archive --delete /home/dir/ serverB:/home/dir > > The trailing slash on the first directory entry is necessary. This > command will keep the directory structure on server B exactly like > what is on server A. No daemons on B need to be started up other > than sshd. > > If you still like find, you could use > > find /home/dir -type f -exec scp {} serverB: \; > > but you'll have to watch out for oddball characters in file names > and new directories on A will not be created on B. > > Doug |
| |||
| Words to the wise, "steeles" <steeles@gmail.com> wrote: >find /home/dir -type f -exec scp {} serverB: \; > >I tried, it, it acutally copy files into "/" in server B, not those files >supposed to be. Well, I guess then you have read on how to correct this. -- Claus Dragon <clauskick@mpsahotmail.com> =(UDIC)= d++ e++ T-- K1!2!3!456!7!S a27 "Coffee is a mocker. So, I am going to mock." - Me, lately. |
| ||||
| steeles wrote: >find /home/dir -type f -exec scp {} serverB: \; > >I tried, it, it acutally copy files into "/" in server B, not those files >supposed to be. I suppose all the files ended up in a flat dir on serverB:home_dir ? What about cd home_dir find . | cpio -dump /net/serverB/home_dir where serverB:home_dir has to be NFS exported Regards fw |