- removeBurnedArchives is tested - removes tgz's that are burned on two or more DVD...
[BackupPC.git] / bin / BackupPC_checkArchiveConsistency
index 05f91ba..2a9b629 100755 (executable)
@@ -1,20 +1,18 @@
-#!/usr/bin/perl -w
+#!/usr/local/bin/perl
 use strict;
 no utf8;
 
-use lib "__INSTALLDIR__/lib";
+use lib "/data/backuppc-agi//lib";
 use DBI;
-
+use BackupPC::Lib;
 
 my $bpc = BackupPC::Lib->new || die "can't create BackupPC::Lib";
 my %Conf = $bpc->Conf();
 
-my $dsn = $Conf{searchdsn} || die "need searchdsn in config.pl\n";
-my $user = $Conf{searchuser} || '';
-my $dbh = dbi->connect($dsn, $user, "", { raiseerror => 1, autocommit => 0 });
+my $dsn = $Conf{SearchDSN} || die "need searchdsn in config.pl\n";
+my $user = $Conf{SearchUser} || '';
+my $dbh = DBI->connect($dsn, $user, "", { raiseerror => 1, autocommit => 0 });
 my $tar_dir = $Conf{InstallDir}.'/'.$Conf{GzipTempDir};
-
-
 my $dvd_nr = $ARGV[0];
 
 if (!defined($dvd_nr)) {
@@ -35,8 +33,8 @@ my $sth = $dbh->prepare($sql);
 $sth->execute($dvd_nr);
 while (my $row = $sth->fetchrow_hashref()) {
        my $host_share = $row->{share};
-       $host_share =~ s/(.*)+:(.*)/$1_$2_/gi;
-       my $filename = $tar_dir."/".$host_share . $row->{num};
+       $host_share =~ s/(.*?):(.*)/$1_$2_/gi;
+       my $filename = $tar_dir."/".$host_share . $row->{num}.".tar.gz";
        my (undef, undef, undef, undef, undef, undef, undef, $fs_size, undef, undef, undef, undef, undef) = stat($filename);
        print "checking $filename...";
        if ($fs_size != $row->{gzip_size}) {