/[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 200 by dpavlin, Thu Oct 13 18:32:59 2005 UTC revision 201 by dpavlin, Fri Oct 14 14:02:51 2005 UTC
# Line 11  use Time::HiRes qw/time/; Line 11  use Time::HiRes qw/time/;
11  use POSIX qw/strftime/;  use POSIX qw/strftime/;
12  use BackupPC::SearchLib;  use BackupPC::SearchLib;
13  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
14    use File::Which;
15    
16  my $path = abs_path($0);  my $path = abs_path($0);
17  $path =~ s#/[^/]+$#/#;  $path =~ s#/[^/]+$#/#;
# Line 18  my $tarIncCreate = $path .= 'BackupPC_ta Line 19  my $tarIncCreate = $path .= 'BackupPC_ta
19    
20  die "can't find $tarIncCreate: $!\n" unless (-x $tarIncCreate);  die "can't find $tarIncCreate: $!\n" unless (-x $tarIncCreate);
21    
22    my $bin;
23    foreach my $c (qw/gzip split/) {
24            $bin->{$c} = which($c) || die "$0 needs $c, install it\n";
25    }
26    
27    
28  my $debug = 0;  my $debug = 0;
29  $|=1;  $|=1;
30    
# Line 94  while (my $row = $sth->fetchrow_hashref) Line 101  while (my $row = $sth->fetchrow_hashref)
101    
102          # re-create archive?          # re-create archive?
103          if ($row->{'inc_size'} == -1 || $size == -1 || $row->{'inc_size'} != $size) {          if ($row->{'inc_size'} == -1 || $size == -1 || $row->{'inc_size'} != $size) {
104                  my $cmd = qq{rm -Rf $tar_dir/$tar_file && $tarIncCreate -h "$row->{'host'}" -s "$row->{'share'}" -n $row->{'num'} | gzip -9 > $tar_dir/$tar_file};                  my $cmd = qq{rm -Rf $tar_dir/$tar_file && $tarIncCreate -h "$row->{'host'}" -s "$row->{'share'}" -n $row->{'num'} | $bin->{'gzip'} -9 > $tar_dir/$tar_file};
105                  print STDERR "## $cmd\n" if ($debug);                  print STDERR "## $cmd\n" if ($debug);
106    
107                  system($cmd) == 0 or die "failed: $?";                  system($cmd) == 0 or die "failed: $?";
# Line 127  while (my $row = $sth->fetchrow_hashref) Line 134  while (my $row = $sth->fetchrow_hashref)
134                          mkdir $in || die "can't mkdir $in: $!";                          mkdir $in || die "can't mkdir $in: $!";
135    
136                          my $suffix_len = length("$parts");                          my $suffix_len = length("$parts");
137                          system("split -d -b $max_size -a $suffix_len $out $in/part") == 0 or die "can't split $out: $?";                          system("$bin->{'split'} -d -b $max_size -a $suffix_len $out $in/part") == 0 or die "can't split $out: $?";
138                          unlink $out || die "can't unlink $out: $!";                          unlink $out || die "can't unlink $out: $!";
139                  }                  }
140    

Legend:
Removed from v.200  
changed lines
  Added in v.201

  ViewVC Help
Powered by ViewVC 1.1.26