7 |
use BackupPC::View; |
use BackupPC::View; |
8 |
use Data::Dumper; |
use Data::Dumper; |
9 |
use Getopt::Std; |
use Getopt::Std; |
10 |
|
use Time::HiRes qw/time/; |
11 |
|
use POSIX qw/strftime/; |
12 |
use constant BPC_FTYPE_DIR => 5; |
use constant BPC_FTYPE_DIR => 5; |
13 |
|
|
14 |
my $debug = 0; |
my $debug = 0; |
15 |
$|=1; |
$|=1; |
16 |
|
|
17 |
|
my $t_fmt = '%Y-%m-%d %H:%M:%S'; |
18 |
|
|
19 |
my $hosts; |
my $hosts; |
20 |
my $bpc = BackupPC::Lib->new || die; |
my $bpc = BackupPC::Lib->new || die; |
21 |
my %Conf = $bpc->Conf(); |
my %Conf = $bpc->Conf(); |
196 |
my $backupNum = $backup->{'num'}; |
my $backupNum = $backup->{'num'}; |
197 |
my @backupShares = (); |
my @backupShares = (); |
198 |
|
|
199 |
print $hosts->{$host_key}->{'host'},"\t#$backupNum\n"; |
print $hosts->{$host_key}->{'host'}, "\t#$backupNum\n"; |
200 |
|
|
201 |
$sth->{backups_broj}->execute($hostID, $backupNum); |
$sth->{backups_broj}->execute($hostID, $backupNum); |
202 |
my ($broj) = $sth->{backups_broj}->fetchrow_array(); |
my ($broj) = $sth->{backups_broj}->fetchrow_array(); |
205 |
my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1); |
my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1); |
206 |
foreach my $share ($files->shareList($backupNum)) { |
foreach my $share ($files->shareList($backupNum)) { |
207 |
|
|
208 |
print "\t$share"; |
my $t = time(); |
209 |
|
|
210 |
|
print strftime($t_fmt,localtime())," ", $share; |
211 |
$shareID = getShareID($share, $hostID, $hostname); |
$shareID = getShareID($share, $hostID, $hostname); |
212 |
|
|
213 |
my ($f, $nf, $d, $nd) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID); |
my ($f, $nf, $d, $nd) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID); |
214 |
print " $nf/$f files $nd/$d dirs\n"; |
printf(" %d/%d files %d/%d dirs [%.2f/s]\n", |
215 |
|
$nf, $f, $nd, $d, |
216 |
|
( ($f+$d) / ((time() - $t) || 1) ) |
217 |
|
); |
218 |
$dbh->commit(); |
$dbh->commit(); |
219 |
} |
} |
220 |
|
|