--- trunk/bin/BackupPC_incPartsUpdate 2005/10/10 13:04:51 157 +++ trunk/bin/BackupPC_incPartsUpdate 2005/10/10 14:05:09 167 @@ -19,7 +19,7 @@ die "can't find $tarIncCreate: $!\n" unless (-x $tarIncCreate); -my $debug = 1; +my $debug = 0; $|=1; my $start_t = time(); @@ -61,9 +61,10 @@ my $sth = $dbh->prepare( qq{ select + backups.id as backup_id, hosts.name as host, shares.name as share, - num as num + backups.num as num from backups join shares on backups.hostid = shares.hostid and shares.id = backups.shareid @@ -75,6 +76,9 @@ $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; while (my $row = $sth->fetchrow_hashref) { @@ -88,7 +92,20 @@ system($cmd) == 0 or die "failed: $?"; - print fmt_time(time() - $t),"\n"; + my $size = (stat( "$tar_dir/$tar_file" ))[7]; + + print " dur: ",fmt_time(time() - $t)," $size bytes"; + + if ($size > 45) { + $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; }