/[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

Contents of /trunk/bin/BackupPC_recover_from_increments

Parent Directory Parent Directory | Revision Log Revision Log


Revision 333 - (show annotations)
Tue Feb 7 21:22:29 2006 UTC (18 years, 2 months ago) by dpavlin
File size: 1348 byte(s)
start of script for disaster recovery: it will re-create BackupPC pool from increments only
1 #!/usr/bin/perl -w
2
3 # quick hack to create BackupPC pool out of increments
4
5 # 2006-02-07 Dobrica Pavlinusic <dpavlin@rot13.org>
6
7 use File::Find;
8 use Data::Dumper;
9
10 use lib "/data/backuppc/lib";
11 use BackupPC::Lib;
12
13
14 my $restore_path = './temp/restore.tar.gz';
15
16 # connect to BackupPC_server
17
18 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
19 my %Conf = $bpc->Conf();
20
21 $bpc->ChildInit();
22
23 my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort});
24 if ( $err ) {
25 print("Can't connect to server ($err)\n");
26 exit(1);
27 }
28
29 sub increment {
30 my $path = $File::Find::name;
31
32 print "working on $path\n";
33
34 if (-e $restore_path) {
35 unlink $restore_path || die "can't remove $restore_path: $!\n";
36 }
37 link $path, $restore_path || die "can't create link $path -> $restore_path: $!\n";
38
39 $bpc->ServerMesg("log User backuppc started restore of $restore_path");
40
41 my $full = 0;
42 my $r = $bpc->ServerMesg("backup restore restore backuppc $full");
43 print "backup --> $r\n";
44
45 # Status_backup_in_progress
46 # Status_idle
47
48 my $state = 'unknown';
49
50 while ($state ne 'Status_idle') {
51 my $s = $bpc->ServerMesg("status hosts");
52 my %Status;
53 {
54 eval "$s";
55 }
56 $state = $Status{restore}->{state};
57 print "# $state\n"; #, Dumper($Status{restore});
58 sleep 1;
59 }
60 }
61
62 find({ wanted => \&increment, follow => 0 }, './temp');
63

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26