/[BackupPC]/trunk/bin/BackupPC_updatedb
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/BackupPC_updatedb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by dpavlin, Sun Jul 31 21:03:36 2005 UTC revision 37 by dpavlin, Fri Aug 19 14:57:30 2005 UTC
# Line 7  use BackupPC::Lib; Line 7  use BackupPC::Lib;
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();
# Line 192  foreach my $host_key (keys %{$hosts}) { Line 196  foreach my $host_key (keys %{$hosts}) {
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();
# Line 201  foreach my $host_key (keys %{$hosts}) { Line 205  foreach my $host_key (keys %{$hosts}) {
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    

Legend:
Removed from v.35  
changed lines
  Added in v.37

  ViewVC Help
Powered by ViewVC 1.1.26