/[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 340 by dpavlin, Mon Mar 6 20:47:00 2006 UTC revision 342 by dpavlin, Tue Mar 7 10:17:56 2006 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3    use strict;
4    
5  =head1 NAME  =head1 NAME
6    
7  BackupPC_recover_from_increments  BackupPC_recover_from_increments
# Line 24  use Data::Dumper; Line 26  use Data::Dumper;
26  use lib "/data/backuppc/lib";  use lib "/data/backuppc/lib";
27  use BackupPC::Lib;  use BackupPC::Lib;
28    
29    my $host = 'restore';
30    
31  # connect to BackupPC_server  # connect to BackupPC_server
32    
33  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 41  my $TopDir = $bpc->TopDir(); Line 45  my $TopDir = $bpc->TopDir();
45    
46  print Dumper(\%Conf);  print Dumper(\%Conf);
47    
48    # check if host exists
49    
50    die "host $host is not found" unless ($bpc->HostInfoRead( $host ));
51    
52  # create restore host configuration  # create restore host configuration
53    
54  my $restore_path = "$TopDir/$temp/restore.tar.gz";  my $restore_path = "$Conf{InstallDir}/$Conf{GzipTempDir}/${host}-restore.tar.gz";
55    
56  my $conf_restore = <<'_END_OF_CONF_';  my $conf_restore = <<'_END_OF_CONF_';
57    
# Line 63  _END_OF_CONF_ Line 71  _END_OF_CONF_
71    
72  $conf_restore =~ s/__restore_path__/$restore_path/gs;  $conf_restore =~ s/__restore_path__/$restore_path/gs;
73    
74  my $config_file = "$bpc->{TopDir}/conf/restore.pl";  my $config_file = "$bpc->{TopDir}/conf/${host}.pl";
75    
76  open(my $host_fh, '>', $config_file) || die "can't open $config_file: $!";  open(my $host_fh, '>', $config_file) || die "can't open $config_file: $!";
77  print $host_fh $conf_restore || die "can't write configuration in $config_file: $!";  print $host_fh $conf_restore || die "can't write configuration in $config_file: $!";
# Line 84  sub restore_increment { Line 92  sub restore_increment {
92          $bpc->ServerMesg("log User backuppc started restore of $path");          $bpc->ServerMesg("log User backuppc started restore of $path");
93    
94          my $full = 0;          my $full = 0;
95          my $r = $bpc->ServerMesg("backup restore restore backuppc $full");          my $r = $bpc->ServerMesg("backup $host $host backuppc $full");
96          print "backup --> $r";          print "backup --> $r";
97            die $r if ($r =~ m/^error/);
98    
99          # Status_backup_in_progress          # Status_backup_in_progress
100          # Status_idle          # Status_idle
# Line 99  sub restore_increment { Line 108  sub restore_increment {
108                          eval "$s";                          eval "$s";
109                  }                  }
110                  $state = $Status{restore}->{state};                  $state = $Status{restore}->{state};
111    
112                    die $state if ($state =~ m/^error/);
113    
114                  if ($state ne $last_state) {                  if ($state ne $last_state) {
115                          print "\n$state"; #, Dumper($Status{restore});                          print "\n$state"; #, Dumper($Status{restore});
116                  } else {                  } else {

Legend:
Removed from v.340  
changed lines
  Added in v.342

  ViewVC Help
Powered by ViewVC 1.1.26