aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-02-28 01:00:45 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-02-28 01:00:45 -0300
commit15b92db9913cf0c0098fab02d05bd1c90f9af771 (patch)
tree6cc0bb2cd56f2e105d519ace409cb0ae2de4914a
parent1f367b40cdb0c790b9c3a1e45fceb4ee79e93c31 (diff)
downloadbackupninja-bug/debian/654192.tar.gz
backupninja-bug/debian/654192.tar.bz2
Rsync handler: use the backup start time and not the time the backup was finished (Debian #654192)bug/debian/654192
-rw-r--r--handlers/rsync.in15
1 files changed, 12 insertions, 3 deletions
diff --git a/handlers/rsync.in b/handlers/rsync.in
index e253c5c..884a885 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -826,7 +826,11 @@ function update_metadata {
if [ "$dest" == "local" ]; then
metadata="`dirname $dest_path`/metadata/`basename $dest_path`"
mkdir -p $metadata
- date +%c%n%s > $metadata/created
+ # Use the backup start time and not the time the backup was
+ # finished, otherwise daily rotations might not take place.
+ # If we used backup end time, in the next handler run
+ # we might not have $now - $created >= 24:00
+ echo $starttime > $metadata/created
$touch $backupdir/$SECTION/$suffix
else
folder="`echo $dest_path | cut -d : -f 2`"
@@ -836,7 +840,11 @@ function update_metadata {
$ssh_cmd <<EOF
##### BEGIN REMOTE SCRIPT #####
mkdir -p $metadata
- date +%c%n%s > $metadata/created
+ # Use the backup start time and not the time the backup was
+ # finished, otherwise daily rotations might not take place.
+ # If we used backup end time, in the next handler run
+ # we might not have $now - $created >= 24:00
+ echo $starttime > $metadata/created
##### END REMOTE SCRIPT #######
EOF
) | (while read a; do passthru $a; done)
@@ -1102,7 +1110,8 @@ start_mux
stop_services
mount_rw
-echo "Starting backup at `date`" >> $log
+starttime="`date +%c%n%s`"
+echo "Starting backup at `echo $starttime | head -n 1`" >> $log
for SECTION in $include; do