Update the destination directory's mtime with each backup.
After rsync, the destination directory's mtime reflects the modification time of its immediate contents. This patch overrides that and sets the mtime to the time that the backup finished. With this patch, the age of a backup can be assessed by looking at its mtime. The advantages of this are (1) that mtime can be preserved, via cp -a or rsync -a, when copying a backup repository to a new hard disk or a new machine and (2) that incorrect mtimes, such as might happen after a user meddles with his backup repository, can be, via touch, corrected. The disadvantage is that mtime for the immediate contents of the destination directory is lost.
This commit is contained in:
parent
923350907d
commit
97df2c14de
1 changed files with 5 additions and 0 deletions
|
@ -536,6 +536,11 @@ while [ "${i}" -lt "${no_sources}" ]; do
|
|||
rsync "$@" "${source}" "${destination_full}"; ret=$?
|
||||
_techo "Finished backup (rsync return code: $ret)."
|
||||
|
||||
#
|
||||
# Set modification time (mtime) to current time
|
||||
#
|
||||
pcmd touch "${destination_dir}"
|
||||
|
||||
#
|
||||
# Check if rsync exit code indicates failure.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue