0

I read about rsync but I want to ask how can I do the following by rsync:

I have two files in to different machine (UNIX-AIX) and have the same name.

server1 : ..../file.txt
server2 : ..../file.txt

I want to apply the following in two server to make sure I have the latest version of file.txt on each server.

server1:

if (mod-time[file.txt (on server 1] > mod-time[file.txt (on server2)] )
 { 
   update file.txt (on server 2 ) to become as file.txt (on server 1) ;
 }
else
 {
  skip ;
 }

server2:

if (mod-time[file.txt (on server2)] > mod-time[file.txt (on server1)] )
 {  
   update file.txt (on server 1 ) to become as file.txt (on server 2) ;
}
else
{
   skip ;    
}

1 Answer 1

3

Try Unison. It's two-way file synchronization software. Documentation.

Sooner or later you have to handle collisions (someone/something modified both files - are you going to merge changes or just overwrite older version).

Also, you might want to use (depending on your use) some version control system to synchronize changes.

6
  • overwrite older version Commented Mar 27, 2011 at 11:03
  • please from where i can download Unix verion please you can give me direct link ???? Commented Mar 27, 2011 at 12:09
  • @Mohammed: click the word "Unison" in Olli's answer. On the Unison home page click the link "downloads" in the menu on the left. Commented Mar 27, 2011 at 12:14
  • yes ... but i don't know which option i will use to UNIX ? Commented Mar 27, 2011 at 12:27
  • @Mohammed: well, this one: seas.upenn.edu/~bcpierce/unison//download/releases/stable , but you have to compile it by yourself. You should refer documentation (linked on my answer).
    – Olli
    Commented Mar 27, 2011 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .