# HG changeset patch # User Heiko Schlittermann (CTQ) # Date 1312206757 -7200 # Node ID 0c6e454093df904eb1a5beb4f1c4063f7cf880f1 # Parent 51a8543685bb058624d8462c69cedb84a1660761 remove old tmp files diff -r 51a8543685bb -r 0c6e454093df bin/ftbackup --- a/bin/ftbackup Mon Aug 01 15:40:43 2011 +0200 +++ b/bin/ftbackup Mon Aug 01 15:52:37 2011 +0200 @@ -206,6 +206,7 @@ # FIXME: currently we simply run a full dump every FULL_CYCLE # days, the intermediate dumps are level 1 foreach (reverse sort $ftp->ls) { + next if /\.tmp-\d+$/; next if not /^(?.*)\.(?\d+)$/; next if not $ftp->size(0) and str2time($+{date}) < $^T; $last[$+{level}] = str2time $+{date}; @@ -323,7 +324,7 @@ if ($ftp) { verbose("sending dump to " . $ftp->pwd . "/$file.tmp-$^T\n"); - $ftp->try(put => $dump, $file); + $ftp->try(put => $dump, "$file.tmp-$^T"); $ftp->try(rename => "$file.tmp-$^T", $file); } else { @@ -642,6 +643,11 @@ my @dumps; foreach ($ftp->ls) { + if (/\.tmp-(?\d+)$/ and $+{timestamp} < $^T) { + INFO "removing old tmp file $_"; + $ftp->delete($_); + next; + }; /^(?.*)\.(?\d+)$/ or next; if (not $ftp->size($_) and str2time($+{date}) < $^T) { INFO "removing old zero size backup $_";