I was wondering if there is a way to tell rsync to only apply changes (delete, overwrite, create) only if all files in the file list transferred successfully.
Just to clarify, this would essentially be putting a transaction around the transfer.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityyou could use a filesystem (btrfs, zfs) with snapshot-features:
you can also enroll your own snapshots:
You could use the --delay-updates
option, or if you want really atomic updates, the atomic-rsync
script (included in Debian as /usr/share/doc/rsync/scripts/atomic-rsync.gz
).
From the 'rsync' man pages, you may be in luck only for deletes:
Some options require rsync to know the full file list, so these options disable the incremental recursion mode. These include: --delete-before, --delete-after, --prune-empty-dirs, and --delay-updates. Because of this, the default delete mode when you specify --delete is now --delete-during when both ends of the connection are at least 3.0.0 (use --del or --delete-during to request this improved deletion mode explicitly). See also the --delete-delay option that is a better choice than using --delete-after.