X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_ASA_ArchiveStart;h=5fb145cf7e891bf6cc7051963661910886ee351c;hp=669a0c142907324a22b421886793d406724db645;hb=38abb9a20f4f9562df117185570646049ce126fb;hpb=34311ffcf9578586eb9a2e2a766af24afd0816d4 diff --git a/bin/BackupPC_ASA_ArchiveStart b/bin/BackupPC_ASA_ArchiveStart index 669a0c1..5fb145c 100755 --- a/bin/BackupPC_ASA_ArchiveStart +++ b/bin/BackupPC_ASA_ArchiveStart @@ -49,15 +49,16 @@ use Getopt::Std; use BackupPC::Lib; use DBI; +use Data::Dump qw(dump); die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); my %opts; # no options currently -if ( !getopts("", \%opts) || @ARGV < 3 ) { +if ( !getopts("", \%opts) || @ARGV < 2 ) { print STDERR <prepare(qq{ }); my $Hosts = $bpc->HostInfoRead(); -my $ArchiveHost = $ARGV[0]; -my $UserName = $ARGV[1]; +my $ArchiveHost = shift @ARGV; +my $UserName = shift @ARGV; +my @HostFilter = @ARGV; my $TopDir = $bpc->{Conf}{TopDir}; if ( !defined($Hosts->{$ArchiveHost}) ) { @@ -87,23 +89,30 @@ if ( !defined($Hosts->{$ArchiveHost}) ) { } $bpc->ConfigRead($ArchiveHost); +if ( ! @HostFilter ) { + @HostFilter = keys %$Hosts; +} + +warn "archiving hosts ",dump(@HostFilter); + my(@HostList, @BackupList); -for ( my $i = 2 ; $i < @ARGV ; $i++ ) { - my ($host,$num) = split(/:/,$ARGV[$i],2); +foreach ( @HostFilter ) { + my ($host,$num) = split(/:/,$_,2); if ( !defined($Hosts->{$host}) ) { print(STDERR "$0: host $host doesn't exist... quitting\n"); exit(1); } my @backups = $bpc->BackupInfoRead($host); if ( !@backups ) { - print(STDERR "$0: host $host doesn't have any backups... quitting\n"); - exit(1); + warn "$0: host $host doesn't have any backups... skipping\n"; + next; } $sth->execute( $host ); if ( $sth->rows == 0 ) { warn "no backups to archive on $host\n"; - next; + push @HostList, $host; + push @BackupList, 0; # fake, but will make full-text update } while ( my $row = $sth->fetchrow_hashref ) { @@ -113,6 +122,8 @@ for ( my $i = 2 ; $i < @ARGV ; $i++ ) { } } +$dbh->disconnect; + my $ReqFileName; for ( my $i = 0 ; ; $i++ ) { $ReqFileName="archiveReq.$$.$i";