The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 rsync - Push or Pull?
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:

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:
machineA# rsync -e ssh --delete --stats -avzcpr root@machineB:`/scripts/` /media

#Push (this however worked)
machineA# rsync -e ssh --delete --stats -avzcpr `/scripts/` 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

# -- syncfiles
ssh chris@machineA "rsync -e ssh --stats -avz `/scripts/` 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
 Re: rsync - Push or Pull?
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
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 

 User Login
 User Name:
 Remember my login:
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum