19 |
|
|
20 |
die "can't find $tarIncCreate: $!\n" unless (-x $tarIncCreate); |
die "can't find $tarIncCreate: $!\n" unless (-x $tarIncCreate); |
21 |
|
|
22 |
my $debug = 1; |
my $debug = 0; |
23 |
$|=1; |
$|=1; |
24 |
|
|
25 |
my $start_t = time(); |
my $start_t = time(); |
61 |
my $sth = $dbh->prepare( qq{ |
my $sth = $dbh->prepare( qq{ |
62 |
|
|
63 |
select |
select |
64 |
|
backups.id as backup_id, |
65 |
hosts.name as host, |
hosts.name as host, |
66 |
shares.name as share, |
shares.name as share, |
67 |
num as num |
backups.num as num |
68 |
from backups |
from backups |
69 |
join shares on backups.hostid = shares.hostid |
join shares on backups.hostid = shares.hostid |
70 |
and shares.id = backups.shareid |
and shares.id = backups.shareid |
76 |
|
|
77 |
$sth->execute(); |
$sth->execute(); |
78 |
|
|
79 |
|
my $sth_inc_size = $dbh->prepare(qq{ update backups set inc_size = ? where id = ? }); |
80 |
|
my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where id = ? }); |
81 |
|
|
82 |
%BackupPC::SearchLib::Conf = %Conf; |
%BackupPC::SearchLib::Conf = %Conf; |
83 |
|
|
84 |
while (my $row = $sth->fetchrow_hashref) { |
while (my $row = $sth->fetchrow_hashref) { |
92 |
|
|
93 |
system($cmd) == 0 or die "failed: $?"; |
system($cmd) == 0 or die "failed: $?"; |
94 |
|
|
95 |
print fmt_time(time() - $t),"\n"; |
my $size = (stat( "$tar_dir/$tar_file" ))[7]; |
96 |
|
|
97 |
|
print " dur: ",fmt_time(time() - $t)," $size bytes"; |
98 |
|
|
99 |
|
if ($size > 45) { |
100 |
|
$sth_inc_size->execute($size, $row->{'backup_id'}); |
101 |
|
} else { |
102 |
|
$sth_inc_deleted->execute(1, $row->{'backup_id'}); |
103 |
|
unlink "$tar_dir/$tar_file" || die "can't delete $tar_dir/$tar_file: $!\n"; |
104 |
|
print " EMPTY"; |
105 |
|
} |
106 |
|
print "\n"; |
107 |
|
|
108 |
|
$dbh->commit; |
109 |
|
|
110 |
} |
} |
111 |
|
|