/[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 95 by dpavlin, Tue Aug 30 09:55:34 2005 UTC revision 97 by dpavlin, Tue Aug 30 09:55:55 2005 UTC
# Line 13  use File::Pid; Line 13  use File::Pid;
13  use POSIX qw/strftime/;  use POSIX qw/strftime/;
14    
15  use constant BPC_FTYPE_DIR => 5;  use constant BPC_FTYPE_DIR => 5;
16    use constant EST_SYNC_EVERY => 10000;
17    
18  my $debug = 0;  my $debug = 0;
19  $|=1;  $|=1;
# Line 85  sub curr_time { Line 86  sub curr_time {
86    
87  my $hest_db;  my $hest_db;
88    
89    sub signal {
90            my($sig) = @_;
91            if ($hest_db) {
92                    print "\nCaught a SIG$sig--syncing database and shutting down\n";
93                    $hest_db->sync();
94                    $hest_db->close();
95            }
96            exit(0);
97    }
98    
99    $SIG{'INT'}  = \&signal;
100    $SIG{'QUIT'} = \&signal;
101    
102  sub hest_update {  sub hest_update {
103    
104          my ($host_id, $share_id, $num) = @_;          my ($host_id, $share_id, $num) = @_;
# Line 197  sub hest_update { Line 211  sub hest_update {
211                          $max--;                          $max--;
212                  }                  }
213    
214                    if ($added % EST_SYNC_EVERY == 0) {
215                            print "sync ";
216                            $db->sync();
217                    }
218    
219          }          }
220    
221          print "sync $added new files";          print "sync $added new files";

Legend:
Removed from v.95  
changed lines
  Added in v.97

  ViewVC Help
Powered by ViewVC 1.1.26