edit for clarity The trick is every sync step is with -u (not replacing updated files) and done again in the other direction before restarting the watch.
edit for clarity The trick is every sync step is with -u (not replacing updated files) and done again in the other direction before restarting the watch.
And the same deletion applies to network errors -- if ssh fails, then newly created files would get deleted.
That said, I agree that -u options does makes it less likely that files get overwritten. This option approach a some caveats, however -- archive extraction will mess the modification time, symlinks and directories are not handled properly. Still, regular IDE editing will work.
Still not sure how is it better than unison though :)
Since there's no lock or anything this vanishing new file just after creation is a possibility. I just wrote this yesterday, I'll be using it extensively, I'll see how annoying this is, and if there's something to do about it.
As a side note, ssh failure has not been a problem (yet), since the script does the same strategy when starting up. In fact I kill and restart this script a lot. I havent played with archive extraction, this is mainly for source code editing.
edit
It would seem that a small modification to the --delete behaviour of rsync to only delete files at the other end that are older than say 30 seconds would handle this edge case. I'll see how annoying it is and if it warrants the time to investigate this.