Added option filesets to backup only some filesets (instead of all of

them).
This commit is contained in:
hjp 2008-03-21 11:12:42 +00:00
parent b32e22fd99
commit 3fa026c805
2 changed files with 16 additions and 0 deletions

7
backup
View File

@ -3,6 +3,12 @@ use warnings;
use strict;
use Simba::CA;
use POSIX qw(strftime);
use Getopt::Long;
my @filesets;
GetOptions('filesets=i' => \@filesets);
@filesets = split(/,/,join(',',@filesets));
$ENV{PATH} = "/usr/bin";
@ -13,6 +19,7 @@ $log->autoflush(1);
my $ca = Simba::CA->new({
dbi_file => $ENV{SIMBA_DB_CONN} || "$ENV{HOME}/.dbi/simba",
fh_log => $log,
(@filesets ? ( filesets => \@filesets ) : ()),
});
$ca->run();

View File

@ -49,6 +49,15 @@ sub new {
);
}
$self->{targets} = $self->{dbh}->selectall_arrayref("select * from filesets", { Slice => {} });
if ($opt->{filesets}) {
$self->{targets} =
[
grep {
my $id = $_->{id};
grep { $id == $_ } @{ $opt->{filesets} }
} @{ $self->{targets} }
];
}
if ($ENV{HOME} =~ m{([/\w]*)}) {
if (-f "$1/.ssh/id_rsa") {
if (my $st = stat("$1/.ssh/id_rsa")) {