aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--handlers/maildir.in1
-rw-r--r--handlers/rsync.in25
3 files changed, 24 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0eeea03..1e20e00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,8 @@ version 1.0 -- UNRELEASED
. Use fatal instead of custom "exit 1" (Redmine#3721).
. Abort on rsync error (Redmine#3692).
. Cleanup orphaned metadata (Redmine#3727).
+ . Use the backup start time and not the time the backup was finished
+ (Closes: #654192)
build system changes
. Workaround automake sanity check that would prevent us from
installing lib/* into lib/backupninja/. Where else are be supposed
diff --git a/handlers/maildir.in b/handlers/maildir.in
index 148c30d..912c0e6 100644
--- a/handlers/maildir.in
+++ b/handlers/maildir.in
@@ -57,7 +57,6 @@ getconf rotate yes
getconf remove yes
getconf backup yes
-getconf loadlimit 5
getconf speedlimit 0
getconf keepdaily 5
getconf keepweekly 3
diff --git a/handlers/rsync.in b/handlers/rsync.in
index 3108b37..f925a20 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -419,6 +419,11 @@ function rotate_long {
else
created=0
fi
+ # Validate created date
+ if [ -z "$created" ] || echo $created | grep -v -q -e '^[0-9]*$'; then
+ warning "Invalid metadata $created. Skipping rotation."
+ break
+ fi
cutoff_time=$(( now - (seconds*(i-1)) ))
if [ ! $created -gt $cutoff_time ]; then
next=$(( i + 1 ))
@@ -537,6 +542,11 @@ function rotate_long_remote {
else
created=0
fi
+ # Validate created date
+ if [ -z "\$created" ] || echo \$created | grep -v -q -e '^[0-9]*$'; then
+ echo "Warning: Invalid metadata \$created. Skipping rotation."
+ break
+ fi
cutoff_time=\$(( now - (seconds*(i-1)) ))
if [ ! \$created -gt \$cutoff_time ]; then
next=\$(( i + 1 ))
@@ -824,7 +834,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`"
@@ -834,7 +848,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)
@@ -1100,7 +1118,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