r8497@llin: dpavlin | 2005-10-13 17:09:51 +0200
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Thu, 13 Oct 2005 15:09:55 +0000 (15:09 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Thu, 13 Oct 2005 15:09:55 +0000 (15:09 +0000)
 re-create tar increments if size differs or if tar file dissapared

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@192 8392b6e1-25fa-0310-8288-cc32f8e212ea

bin/BackupPC_incPartsUpdate

index 3f84fff..6d3d200 100755 (executable)
@@ -63,12 +63,13 @@ select
        backups.id as backup_id,
        hosts.name as host,
        shares.name as share,
-       backups.num as num
+       backups.num as num,
+       inc_size
 from backups
        join shares on backups.hostid = shares.hostid
                and shares.id = backups.shareid
        join hosts on shares.hostid = hosts.id
-where inc_size < 0 and not inc_deleted
+where not inc_deleted
 order by backups.date
 
 } );
@@ -82,6 +83,12 @@ my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where
 
 while (my $row = $sth->fetchrow_hashref) {
        my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'});
+
+       my $size = -1;
+       $size = (stat( "$tar_dir/$tar_file" ))[7] if (-e "$tar_dir/$tar_file");
+
+       next if ($row->{'inc_size'} != -1 && $size != -1 && $row->{'inc_size'} == $size);
+
        print curr_time, " ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file";
 
        my $t = time();