Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

synchronize directories 1

Status
Not open for further replies.

Themuppeteer

Programmer
Apr 4, 2001
449
BE
If I have 2 (or more) linux machines, is there then a way to automatically synchronize directories ? example:

on my first machine tere is a directory /myImages with some image files. On a second machine I have the same directory but with less images. How can I automatically let the files missing on the second machine being copied to it. And even more, I'd like a system where I have e.g. 5 linux machines that have that same directory continuously synchronized with each other, so if e.g. I add a file to one of the machines, it automatically gets copied to all the others to.

I know this isn't the easiest thing to do, but I was wondering (hoping) that on a network based system like linux there might already be such a program to do that.

Any clues ? Greetz,
muppeteer.gif


NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)

"Those who say they understand chess, understand nothing"

-- Robert HUBNER
 
It depends how up to date you want the information to be - take a look at rsync. That would probably be your best bet - you would sync directories at specified time intervals using a cron task.

man rsync
man crontab

Regards,
ChrisCW

** Helen Waite is now in charge of all rush orders. If you are in a hurry, just go to Helen Waite.
 
Guess this is exactely what I need :)

Just one strange question:
How will sync react if on one machine a file doesn't exist and on another it does ? will it copy the file ? if so, what if the machine where the file is missing is the 'current state',the most correct one ? and so it should in fact delete the file from the other machine.
Or can you configure this all ? Greetz,
muppeteer.gif


NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)

"Those who say they understand chess, understand nothing"

-- Robert HUBNER
 
It is all on the man rsync page - the --delete option will delete files on the remote server that are not present on the sending side.

This is completely configurable - one of the best features is its 'mirror' type function that will compare one directory structure to another and only copy the files that do not exist or have changed.

Have a good read of the man page, and there is plenty of documentation on the web about it...

ChrisCW

** Helen Waite is now in charge of all rush orders. If you are in a hurry, just go to Helen Waite.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top