"%c %o",
[ 'host|h=s@', "import just host(s)" ],
[ 'num|n=s@', "import just backup number(s)" ],
+[ 'ok=n', "xferOK", { default => 0 } ],
[ 'check|c', "check archives on disk and sync", { default => 1 } ],
[ 'debug|d', "debug", { default => 1 } ],
[ 'help', "show help" ],
});
$sth_insert->execute($backup_id, $part_nr, $tar_size, $size, $md5, $items, $filename);
- $dbh->commit;
}
print " [parts: ",join(", ", @tar_parts),"]" if $opt->debug;
$part_nr,
get_backup_id($host, $num),
);
- $dbh->commit;
@tar_files = sort @tar_files;
print "\n\t",($#tar_files + 1), " tar files";
print " ",($same ? 'ok' : 'DIFFERENT'),
", dur: ",fmt_time(time() - $t), "\n";
+ $dbh->commit;
+
return $same;
}
my $host = $opt->host->[$_];
my $num = $opt->num->[$_];
- check_archive $host => $num;
+ if ( ! $opt->ok ) {
+ warn "ERROR $host $num running cleanup";
+ foreach my $path ( glob "$Conf{ArchiveDest}/$host.$num.*" ) {
+ warn "# rm $path";
+ unlink $path || die $!;
+ }
+ } else {
+ check_archive $host => $num;
+ }
}
print ", dur: ",fmt_time(time() - $t), "\n";
- $dbh->commit;
-
}
undef $sth;