update inc_deleted if I can't produce tar increment
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Mon, 10 Oct 2005 13:50:51 +0000 (13:50 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Mon, 10 Oct 2005 13:50:51 +0000 (13:50 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@163 8392b6e1-25fa-0310-8288-cc32f8e212ea

bin/BackupPC_incPartsUpdate

index 794db78..4539867 100755 (executable)
@@ -77,6 +77,7 @@ order by backups.date
 $sth->execute();
 
 my $sth_inc_size = $dbh->prepare(qq{ update backups set inc_size = ? where id = ? });
+my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where id = ? });
 
 %BackupPC::SearchLib::Conf = %Conf;
 
@@ -93,9 +94,16 @@ while (my $row = $sth->fetchrow_hashref) {
 
        my $size = (stat( "$tar_dir/$tar_file" ))[7];
 
-       print " dur: ",fmt_time(time() - $t)," $size bytes\n";
+       print " dur: ",fmt_time(time() - $t)," $size bytes";
 
-       $sth_inc_size->execute($size, $row->{'backup_id'});
+       if ($size > 20) {
+               $sth_inc_size->execute($size, $row->{'backup_id'});
+       } else {
+               $sth_inc_deleted->execute(1, $row->{'backup_id'});
+               unlink "$tar_dir/$tar_file" || die "can't delete $tar_dir/$tar_file: $!\n";
+               print " EMPTY";
+       }
+       print "\n";
 
        $dbh->commit;