/[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 306 by dpavlin, Sat Jan 28 20:42:42 2006 UTC revision 311 by dpavlin, Sun Jan 29 14:54:17 2006 UTC
# Line 58  my $dbh = DBI->connect($dsn, $user, "", Line 58  my $dbh = DBI->connect($dsn, $user, "",
58    
59  my %opt;  my %opt;
60    
61  if ( !getopts("cdm:v:ijf", \%opt ) ) {  if ( !getopts("cdm:v:ijfq", \%opt ) ) {
62          print STDERR <<EOF;          print STDERR <<EOF;
63  usage: $0 [-c|-d] [-m num] [-v|-v level] [-i|-j|-f]  usage: $0 [-c|-d] [-m num] [-v|-v level] [-i|-j|-f]
64    
# Line 70  Options: Line 70  Options:
70          -i      update Hyper Estraier full text index          -i      update Hyper Estraier full text index
71          -j      update full text, don't check existing files          -j      update full text, don't check existing files
72          -f      don't do anything with full text index          -f      don't do anything with full text index
73            -q      be quiet for hosts without changes
74    
75  Option -j is variation on -i. It will allow faster initial creation  Option -j is variation on -i. It will allow faster initial creation
76  of full-text index from existing database.  of full-text index from existing database.
# Line 462  foreach my $host_key (@hosts) { Line 463  foreach my $host_key (@hosts) {
463          }          }
464    
465          $host_nr++;          $host_nr++;
         print "host ", $hosts->{$host_key}->{'host'}, " [",  
                 $host_nr, "/", ($#hosts + 1), "]: ";  
   
466          # get backups for a host          # get backups for a host
467          my @backups = $bpc->BackupInfoRead($hostname);          my @backups = $bpc->BackupInfoRead($hostname);
468          my $incs = scalar @backups;          my $incs = scalar @backups;
         print  "$incs increments\n";  
469    
470            my $host_header = sprintf("host %s [%d/%d]: %d increments\n",
471                    $hosts->{$host_key}->{'host'},
472                    $host_nr,
473                    ($#hosts + 1),
474                    $incs
475            );
476            print $host_header unless ($opt{q});
477    
478          my $inc_nr = 0;          my $inc_nr = 0;
479          $beenThere = {};          $beenThere = {};
480    
# Line 481  foreach my $host_key (@hosts) { Line 486  foreach my $host_key (@hosts) {
486                  my $backupNum = $backup->{'num'};                  my $backupNum = $backup->{'num'};
487                  my @backupShares = ();                  my @backupShares = ();
488    
489                  printf("%-10s %2d/%-2d #%-2d %s %5s/%5s files (date: %s dur: %s)\n",                  my $share_header = sprintf("%-10s %2d/%-2d #%-2d %s %5s/%5s files (date: %s dur: %s)\n",
490                          $hosts->{$host_key}->{'host'},                          $hosts->{$host_key}->{'host'},
491                          $inc_nr, $incs, $backupNum,                          $inc_nr, $incs, $backupNum,
492                          $backup->{type} || '?',                          $backup->{type} || '?',
# Line 489  foreach my $host_key (@hosts) { Line 494  foreach my $host_key (@hosts) {
494                          strftime($t_fmt,localtime($backup->{startTime})),                          strftime($t_fmt,localtime($backup->{startTime})),
495                          fmt_time($backup->{endTime} - $backup->{startTime})                          fmt_time($backup->{endTime} - $backup->{startTime})
496                  );                  );
497                    print $share_header unless ($opt{q});
498    
499                  my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1);                  my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1);
500                  foreach my $share ($files->shareList($backupNum)) {                  foreach my $share ($files->shareList($backupNum)) {
# Line 502  foreach my $host_key (@hosts) { Line 508  foreach my $host_key (@hosts) {
508                          # skip if allready in database!                          # skip if allready in database!
509                          next if ($count > 0);                          next if ($count > 0);
510    
511                            # dump host and share header for -q
512                            if ($opt{q}) {
513                                    if ($host_header) {
514                                            print $host_header;
515                                            $host_header = undef;
516                                    }
517                                    print $share_header;
518                            }
519    
520                          # dump some log                          # dump some log
521                          print curr_time," ", $share;                          print curr_time," ", $share;
522    

Legend:
Removed from v.306  
changed lines
  Added in v.311

  ViewVC Help
Powered by ViewVC 1.1.26