--- trunk/bin/BackupPC_updatedb 2005/07/31 21:03:36 35 +++ trunk/bin/BackupPC_updatedb 2005/08/19 14:57:30 37 @@ -7,11 +7,15 @@ use BackupPC::View; use Data::Dumper; use Getopt::Std; +use Time::HiRes qw/time/; +use POSIX qw/strftime/; use constant BPC_FTYPE_DIR => 5; my $debug = 0; $|=1; +my $t_fmt = '%Y-%m-%d %H:%M:%S'; + my $hosts; my $bpc = BackupPC::Lib->new || die; my %Conf = $bpc->Conf(); @@ -192,7 +196,7 @@ my $backupNum = $backup->{'num'}; my @backupShares = (); - print $hosts->{$host_key}->{'host'},"\t#$backupNum\n"; + print $hosts->{$host_key}->{'host'}, "\t#$backupNum\n"; $sth->{backups_broj}->execute($hostID, $backupNum); my ($broj) = $sth->{backups_broj}->fetchrow_array(); @@ -201,11 +205,16 @@ my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1); foreach my $share ($files->shareList($backupNum)) { - print "\t$share"; + my $t = time(); + + print strftime($t_fmt,localtime())," ", $share; $shareID = getShareID($share, $hostID, $hostname); my ($f, $nf, $d, $nd) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID); - print " $nf/$f files $nd/$d dirs\n"; + printf(" %d/%d files %d/%d dirs [%.2f/s]\n", + $nf, $f, $nd, $d, + ( ($f+$d) / ((time() - $t) || 1) ) + ); $dbh->commit(); }