]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Fix: exit rsync handler if there is already a created metadata file for $dir.1
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 20 Sep 2010 21:04:45 +0000 (18:04 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 20 Sep 2010 21:04:45 +0000 (18:04 -0300)
files/handlers/rsync

index 2b9da5aac685f1b135877e9ec9b76c3271cbc492..dffcfc593492e6647fe9a048e5881b8afb466957 100644 (file)
@@ -416,6 +416,7 @@ function rotate_long {
             $nice mv $dir.$i $dir.$next
             mkdir -p $backuproot/metadata/$rottype.$next
             date +%c%n%s > $backuproot/metadata/$rottype.$next/rotated
+            rm -f $backuproot/metadata/$rottype.$next/created
           else
             echo "Debug: skipping rotation of $dir.$i because $dir.$next already exists."
           fi
@@ -517,6 +518,7 @@ function rotate_long_remote {
             $nice mv \$dir.\$i \$dir.\$next
             mkdir -p $backuproot/metadata/\$rottype.\$next
             date +%c%n%s > $backuproot/metadata/\$rottype.\$next/rotated
+            rm -f $backuproot/metadata/\$rottype.\$next/created
           else
             echo "Debug: skipping rotation of \$dir.\$i because \$dir.\$next already exists."
           fi
@@ -528,7 +530,7 @@ function rotate_long_remote {
   done
 
   max=\$((keepdaily+1))
-  if [ \$keepweekly -gt 0 -a -d $backuproot/daily.\$max -a ! -d \$backuproot/weekly.1 ]; then
+  if [ \$keepweekly -gt 0 -a -d $backuproot/daily.\$max -a ! -d $backuproot/weekly.1 ]; then
     echo "Debug: daily.\$max --> weekly.1"
     $nice mv $backuproot/daily.\$max $backuproot/weekly.1
     mkdir -p $backuproot/metadata/weekly.1
@@ -581,7 +583,8 @@ function setup_long_dirs {
 
   if [ -d $dir.1 ]; then
     if [ -f $metadata/created ]; then
-      echo "Warning: $dir.1 already exists. Overwriting contents."
+      echo "Warning: $dir.1 already exists, aborting."
+      exit
     else
       echo "Warning: we seem to be resuming a partially written $dir.1"
     fi
@@ -631,7 +634,8 @@ function setup_long_dirs_remote {
 
   if [ -d $dir.1 ]; then
     if [ -f $metadata/created ]; then
-      echo "Warning: $dir.1 already exists. Overwriting contents."
+      echo "Warning: $dir.1 already exists, aborting."
+      exit
     else
       echo "Warning: we seem to be resuming a partially written $dir.1"
     fi