|
Author: Chris Peterson
Date: 10-03-02 09:41
So I played around with the rsync and the article got me going with the basics. I was able to transfer directory structures and everything worked great.
I have a unique problem that i wanted rsync to solve. However, on initial use i was not able to use it the way i originally intended and found a work around. I will setup the scenario for you and maybe someone can help find a better solution.
I have MachineA and a hundred of MachineB's
MachineA has a directory full of files:
/data
Each Machine B has a database with a list of files it needs. Which may not be a complete list of files on MachineA. I have a script that pulls the file list out of the database and I want to sync those files only. If a file gets removed from the database i want it removed from the directory. If a file gets added to the database or updated i want rsync to grab the file.
I tried many different ways to do rsync and found that I couldn't execute a command like this:
#Pull
machineA# rsync -e ssh --delete --stats -avzcpr root@machineB:`/scripts/grabmedia.pl` /media
#Push (this however worked)
machineA# rsync -e ssh --delete --stats -avzcpr `/scripts/grabmedia.pl` machineB:/media
I wanted to Pull because machine B is a remote site and wanted each machine to iniate the download for speed reasons. (does it make a difference?)
The solution i came up with is below to make it work was:
setup ssh authorized keys and then execute this command
#/bin/sh
# -- syncfiles
ssh chris@machineA "rsync -e ssh --stats -avz `/scripts/grabmedia.pl` chris@machineB:/media"
Is my logic all off? Should i just be running the cronjobs on the server and push to all 100?
I thought the pull(download) was quicker. Plus the machineB's are the ones keeping track of what files it needs.
Any help would be cool.
Thanks in advance!
Chris Peterson
|
|
Reply To This Message
|
|
Author: Dan Langille
Date: 10-03-02 19:06
I think you should be asking your question in the Support forum where many more people will read it, not just those reading this article and then clicking on the comments.
|
|
Reply To This Message
|
|