82 |
|
|
83 |
} ); |
} ); |
84 |
|
|
|
$sth->execute(); |
|
|
|
|
85 |
my $sth_inc_size = $dbh->prepare(qq{ update backups set inc_size = ?, parts = ? where id = ? }); |
my $sth_inc_size = $dbh->prepare(qq{ update backups set inc_size = ?, parts = ? where id = ? }); |
86 |
my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where id = ? }); |
my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where id = ? }); |
87 |
|
|
88 |
%BackupPC::SearchLib::Conf = %Conf; |
%BackupPC::SearchLib::Conf = %Conf; |
89 |
|
|
90 |
|
$sth->execute(); |
91 |
|
my $num_backups = $sth->rows; |
92 |
|
my $curr_backup = 1; |
93 |
|
|
94 |
while (my $row = $sth->fetchrow_hashref) { |
while (my $row = $sth->fetchrow_hashref) { |
95 |
my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}); |
my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}); |
96 |
|
|
97 |
# this will return -1 if file doesn't exist |
# this will return -1 if file doesn't exist |
98 |
my $size = BackupPC::SearchLib::get_tgz_size_by_name($tar_file); |
my $size = BackupPC::SearchLib::get_tgz_size_by_name($tar_file); |
99 |
|
|
100 |
print curr_time, " ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file"; |
print curr_time, " $curr_backup/$num_backups ", $row->{'host'}, ":", $row->{'share'}, " #", $row->{'num'}, " -> $tar_file"; |
101 |
|
$curr_backup++; |
102 |
|
|
103 |
my $t = time(); |
my $t = time(); |
104 |
|
|
109 |
|
|
110 |
system($cmd) == 0 or die "failed: $?"; |
system($cmd) == 0 or die "failed: $?"; |
111 |
|
|
112 |
rename "${tar_dir}/${$tar_file}.tmp", "$tar_dir/$tar_file" or die "can't rename $tar_dir/$tar_file: $!"; |
rename("${tar_dir}/${tar_file}.tmp", "$tar_dir/$tar_file") or die "can't rename $tar_dir/$tar_file: $!"; |
113 |
|
|
114 |
$size = (stat( "$tar_dir/$tar_file" ))[7]; |
$size = (stat( "$tar_dir/$tar_file" ))[7]; |
115 |
} |
} |