/[BackupPC]/trunk/bin/BackupPC_recover_from_increments
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_recover_from_increments

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

revision 345 by dpavlin, Tue Mar 7 10:48:28 2006 UTC revision 348 by dpavlin, Tue Mar 7 16:14:49 2006 UTC
# Line 85  warn "written config:\n$conf_restore\n"; Line 85  warn "written config:\n$conf_restore\n";
85  sub restore_increment {  sub restore_increment {
86          my $path = shift || die "need path!";          my $path = shift || die "need path!";
87    
88            if ($path !~ m/\.tar\.gz$/i) {
89                    print "skipping $path, not .tar.gz increment\n";
90                    return;
91            }
92    
93          print "working on $path\n";          print "working on $path\n";
94    
95          if (-e $restore_path) {          if (-e $restore_path) {
96                  unlink $restore_path || die "can't remove $restore_path: $!\n";                  unlink $restore_path || die "can't remove $restore_path: $!\n";
97          }          }
98          link $path, $restore_path || die "can't create link $path -> $restore_path: $!\n";          symlink $path, $restore_path || die "can't create link $path -> $restore_path: $!\n";
99    
100          my $user = $host_info->{$host}->{user} || die "can't get user for host $host";          my $user = $host_info->{$host}->{user} || die "can't get user for host $host";
101    
102          $bpc->ServerMesg("log User $user started recovery from increment $path");          $bpc->ServerMesg("log User $user started recovery from increment $path");
103    
104          my $full = 0;          my @backups = $bpc->BackupInfoRead( $host );
105    
106            my $full = 1;
107            foreach my $b (@backups) {
108                    $full = 0 if ($b->{type} eq 'full');
109            }
110    
111          my $r = $bpc->ServerMesg("backup $host $host $user $full");          my $r = $bpc->ServerMesg("backup $host $host $user $full");
112          print "backup --> $r";          print "backup ", $full ? 'full' : 'incremental', " --> $r";
113          die $r if ($r =~ m/^error/);          die $r if ($r =~ m/^error/);
114    
115          # Status_backup_in_progress          # Status_backup_in_progress
# Line 137  foreach my $restore_inc (@ARGV) { Line 148  foreach my $restore_inc (@ARGV) {
148                          restore_increment( $File::Find::name );                          restore_increment( $File::Find::name );
149                  }, follow => 0 }, $restore_inc);                  }, follow => 0 }, $restore_inc);
150    
151          } elsif (-f $restore_inc && $restore_inc =~ m/\.tar\.gz$/i) {          } elsif (-f $restore_inc) {
152                  restore_increment( $restore_inc );                  restore_increment( $restore_inc );
153          } else {          } else {
154                  warn "skipped: $restore_inc, not directory or .tar.gz increment\n";                  warn "skipped: $restore_inc, not file or directory\n";
155          }          }
156    
157  }  }

Legend:
Removed from v.345  
changed lines
  Added in v.348

  ViewVC Help
Powered by ViewVC 1.1.26