/[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 359 by dpavlin, Thu Apr 27 09:45:01 2006 UTC revision 360 by dpavlin, Fri Apr 28 09:07:41 2006 UTC
# Line 30  use BackupPC::Lib; Line 30  use BackupPC::Lib;
30  my $host = 'restore';  my $host = 'restore';
31  my $share = '/etc';  my $share = '/etc';
32    
33    # this option will cleanup tar dump before import of each increment
34    # WARNING: this will create increments which contain only new files, not
35    # state of share in that particular moment! (it's fast, though)
36    my $cleanup_before_increment = 0;
37    
38  # connect to BackupPC_server  # connect to BackupPC_server
39    
40  die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );  die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
# Line 56  die "host '$host' is not found, please a Line 61  die "host '$host' is not found, please a
61  # take care of temporary directory for increments  # take care of temporary directory for increments
62    
63  my $inc_tmp_dir = $Conf{IncrementTempDir} || die "need working directory in IncrementTempDir\n";  my $inc_tmp_dir = $Conf{IncrementTempDir} || die "need working directory in IncrementTempDir\n";
 rmtree($inc_tmp_dir) if (-e $inc_tmp_dir);  
64    
65  mkpath($inc_tmp_dir);  sub cleanup_inc_temp_dir {
66            rmtree($inc_tmp_dir) if (-e $inc_tmp_dir);
67            mkpath($inc_tmp_dir);
68    }
69    
70  print "# using $inc_tmp_dir for increment scratch space";  print "# using $inc_tmp_dir for increment scratch space";
71    cleanup_inc_temp_dir() if (! $cleanup_before_increment);
72    
73  # create restore host configuration  # create restore host configuration
74    
# Line 108  sub restore_increment { Line 116  sub restore_increment {
116    
117          print "restoring $path\n";          print "restoring $path\n";
118    
119            cleanup_inc_temp_dir() if ($cleanup_before_increment);
120    
121          my $cmd = "cd $inc_tmp_dir && tar xfz $path";          my $cmd = "cd $inc_tmp_dir && tar xfz $path";
122          system($cmd) == 0 or die "can't execute: $cmd -- $?\n";          system($cmd) == 0 or die "can't execute: $cmd -- $?\n";
123    

Legend:
Removed from v.359  
changed lines
  Added in v.360

  ViewVC Help
Powered by ViewVC 1.1.26