/[BackupPC]/trunk/bin/BackupPC_incPartsUpdate
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_incPartsUpdate

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

revision 292 by dpavlin, Wed Jan 18 15:16:31 2006 UTC revision 293 by dpavlin, Thu Jan 26 00:40:37 2006 UTC
# Line 18  use Getopt::Std; Line 18  use Getopt::Std;
18  use File::Slurp;  use File::Slurp;
19  use File::Pid;  use File::Pid;
20    
21    =head1 NAME
22    
23    BackupPC_incPartsUpdate
24    
25    =head1 DESCRIPTION
26    
27    Create C<.tar.gz> increments on disk calling C<BackupPC_tarIncCreate>.
28    
29    Following options are supported (but all are optional):
30    
31    =over 4
32    
33    =item -h hostname
34    
35    Update parts for just single C<hostname>
36    
37    =item -c
38    
39    Force check for tar archives which exist on disk
40    
41    =item -d
42    
43    Turn debugging output
44    
45    =back
46    
47    =cut
48    
49    my %opt;
50    getopts("cdh:", \%opt );
51    
52    my $debug = $opt{d};
53    my $check = $opt{c} && print STDERR "NOTICE: tar archive check forced\n";
54    
55  my $pid_path = abs_path($0);  my $pid_path = abs_path($0);
56  $pid_path =~ s/\W+/_/g;  $pid_path =~ s/\W+/_/g;
57    
# Line 52  foreach my $c (qw/gzip md5sum/) { Line 86  foreach my $c (qw/gzip md5sum/) {
86          $bin->{$c} = which($c) || die "$0 needs $c, install it\n";          $bin->{$c} = which($c) || die "$0 needs $c, install it\n";
87  }  }
88    
 my %opt;  
 getopts("cd", \%opt );  
   
 my $debug = $opt{d};  
 my $check = $opt{c} && print STDERR "NOTICE: tar archive check forced\n";  
   
89  $|=1;  $|=1;
90    
91  my $start_t = time();  my $start_t = time();
# Line 365  $sth->execute(); Line 393  $sth->execute();
393  my $num_backups = $sth->rows;  my $num_backups = $sth->rows;
394  my $curr_backup = 1;  my $curr_backup = 1;
395    
396    if ($opt{h}) {
397            warn "making increments just for host $opt{h}\n";
398    }
399    
400  while (my $row = $sth->fetchrow_hashref) {  while (my $row = $sth->fetchrow_hashref) {
401    
402            if ($opt{h} && $row->{host} ne $opt{h}) {
403                    warn "skipped $row->{host}\n" if ($debug);
404                    next;
405            }
406    
407          $curr_backup++;          $curr_backup++;
408    
409          my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'});          my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'});

Legend:
Removed from v.292  
changed lines
  Added in v.293

  ViewVC Help
Powered by ViewVC 1.1.26