From 97df2c14dec483d54e21cf77e8aadc9a7d9b6e87 Mon Sep 17 00:00:00 2001 From: jll2 Date: Thu, 25 Jun 2009 16:20:00 -0700 Subject: [PATCH] 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. --- ccollect.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ccollect.sh b/ccollect.sh index bb8549b..7f5ae67 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -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. #