rsync update and date/time difference on local/remote server

P

postcd

Guest
Hello,

2 servers and im sincing files using rsync -u (update switch) between them.
and i want to prevent overwrite file that i editted most recently.
i want to ask if date and time is not same on 2 servers, can rsync overwrite the my recently editted file by one that was editted at earlier time? just because source server has time set lets say several hours in advance in comparison to dest. server? thx

im currently using rsync -au

i want to rsync the way that target file have same timestamp. and with oposite direction rsync later on, rsync will skip the file even if file has different size, but same time stamp (mod. date)
how to achieve this please?
 
Last edited:


Since rsync looks at file size and the timestamp you really can't prevent it from skipping the update. Even if you used the -c option to change the default behavior and perform a checksum check the files would still be mismatched and an update would occur.

I don't see any way around you dilemma with rsync.
 
Not sure I understand the question but...

"i want to ask if date and time is not same on 2 servers, can rsync overwrite the my recently editted file by one that was editted at earlier time?"

Yes. Do not use -u and rsync will copy over the destination file (ovrwrite) despite destination having newer timestamp. If you want to prevent overwrite then use -u option as you already are.

If you want rsync to work the other way then issue the command to rsync from server2 to server1 for example, if you were rsyncing from server1 to server2 before.
 

Members online


Latest posts

Top