projects
/
BackupPC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b97f4cf
)
without params archive all hosts
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 27 Jan 2011 18:31:53 +0000
(18:31 +0000)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 27 Jan 2011 18:31:53 +0000
(18:31 +0000)
bin/BackupPC_ASA_ArchiveStart
patch
|
blob
|
history
diff --git
a/bin/BackupPC_ASA_ArchiveStart
b/bin/BackupPC_ASA_ArchiveStart
index
669a0c1
..
14209c4
100755
(executable)
--- a/
bin/BackupPC_ASA_ArchiveStart
+++ b/
bin/BackupPC_ASA_ArchiveStart
@@
-49,15
+49,16
@@
use Getopt::Std;
use BackupPC::Lib;
use DBI;
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
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 <<EOF;
print STDERR <<EOF;
-usage: $0 archiveHost userName
hosts[:num]...
+usage: $0 archiveHost userName
[hosts[:num]...]
EOF
exit(1);
}
EOF
exit(1);
}
@@
-77,8
+78,9
@@
my $sth = $dbh->prepare(qq{
});
my $Hosts = $bpc->HostInfoRead();
});
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}) ) {
my $TopDir = $bpc->{Conf}{TopDir};
if ( !defined($Hosts->{$ArchiveHost}) ) {
@@
-87,17
+89,23
@@
if ( !defined($Hosts->{$ArchiveHost}) ) {
}
$bpc->ConfigRead($ArchiveHost);
}
$bpc->ConfigRead($ArchiveHost);
+if ( ! @HostFilter ) {
+ @HostFilter = keys %$Hosts;
+}
+
+warn "archiving hosts ",dump(@HostFilter);
+
my(@HostList, @BackupList);
my(@HostList, @BackupList);
-for
( my $i = 2 ; $i < @ARGV ; $i++
) {
- my ($host,$num) = split(/:/,$
ARGV[$i]
,2);
+for
each ( @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 ) {
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 );
}
$sth->execute( $host );