Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ;    
}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
overwrite older version –  Mohammad AL-Rawabdeh Mar 27 '11 at 11:03
    
please from where i can download Unix verion please you can give me direct link ???? –  Mohammad AL-Rawabdeh Mar 27 '11 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. –  RedGrittyBrick Mar 27 '11 at 12:14
    
yes ... but i don't know which option i will use to UNIX ? –  Mohammad AL-Rawabdeh Mar 27 '11 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 Mar 27 '11 at 17:02
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.