diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-09-20 18:04:45 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-09-20 18:04:45 -0300 |
commit | aef44c74537a86768506021fa75c052e52f31a5d (patch) | |
tree | 678fb4ea739fe08c3f1e7ebcad7ea8b4d3ed1ff4 /files/handlers | |
parent | 3468af105bcd312e1617c05bef3259b6adf78d86 (diff) | |
download | puppet-backup-aef44c74537a86768506021fa75c052e52f31a5d.tar.gz puppet-backup-aef44c74537a86768506021fa75c052e52f31a5d.tar.bz2 |
Fix: exit rsync handler if there is already a created metadata file for $dir.1
Diffstat (limited to 'files/handlers')
-rw-r--r-- | files/handlers/rsync | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/files/handlers/rsync b/files/handlers/rsync index 2b9da5a..dffcfc5 100644 --- a/files/handlers/rsync +++ b/files/handlers/rsync @@ -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 |