3 # quick hack to create BackupPC pool out of increments
5 # 2006-02-07 Dobrica Pavlinusic <dpavlin@rot13.org>
10 use lib "/data/backuppc/lib";
14 my $restore_path = './temp/restore.tar.gz';
16 # connect to BackupPC_server
18 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
19 my %Conf = $bpc->Conf();
23 my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort});
25 print("Can't connect to server ($err)\n");
30 my $path = $File::Find::name;
32 print "working on $path\n";
34 if (-e $restore_path) {
35 unlink $restore_path || die "can't remove $restore_path: $!\n";
37 link $path, $restore_path || die "can't create link $path -> $restore_path: $!\n";
39 $bpc->ServerMesg("log User backuppc started restore of $restore_path");
42 my $r = $bpc->ServerMesg("backup restore restore backuppc $full");
43 print "backup --> $r\n";
45 # Status_backup_in_progress
48 my $state = 'unknown';
50 while ($state ne 'Status_idle') {
51 my $s = $bpc->ServerMesg("status hosts");
56 $state = $Status{restore}->{state};
57 print "# $state\n"; #, Dumper($Status{restore});
62 find({ wanted => \&increment, follow => 0 }, './temp');