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.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 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:
/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  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 rsync - Push or Pull?   new
Chris Peterson 10-03-02 09:41 
 Re: rsync - Push or Pull?   new
Dan Langille 10-03-02 19:06 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 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

phorum.org