Bug 5804 - Make atomic-rsync atomic
Summary: Make atomic-rsync atomic
Status: VERIFIED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.0
Hardware: All All
: P3 minor (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-01 20:28 UTC by Matt McCutchen
Modified: 2008-10-11 13:42 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt McCutchen 2008-10-01 20:28:25 UTC
The support/atomic-rsync script is not actually atomic because it moves the old destination directory out of place and then moves the updated one into place.  Make it atomic by having the destination path be a symlink to the actual tree and atomically replacing this symlink when an updated tree is ready.
Comment 1 Wayne Davison 2008-10-11 11:34:51 UTC
The script now supports this if the user has setup the supplied destination as a symlink to a directory that ends in -1 or -2.  i.e.:

mkdir /tmp/dest-1
ln -s dest-1 /tmp/dest
atomic-rsync -av /tmp/src/ /tmp/dest/

That would end up with /tmp/dest symlinked to the new /tmp/dest-2 dir.  A re-run of the atomic-rsync command would replace the /tmp/dest-1 dir and change the symlink back.  Etc.
Comment 2 Matt McCutchen 2008-10-11 13:42:49 UTC
Looks good!  Thanks!