The Samba-Bugzilla – Bug 5804
Make atomic-rsync atomic
Last modified: 2008-10-11 13:42:49 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.
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.:
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.
Looks good! Thanks!