Added option filesets to backup only some filesets (instead of all of
them).
This commit is contained in:
parent
b32e22fd99
commit
3fa026c805
7
backup
7
backup
|
@ -3,6 +3,12 @@ use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
use Simba::CA;
|
use Simba::CA;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
|
my @filesets;
|
||||||
|
|
||||||
|
GetOptions('filesets=i' => \@filesets);
|
||||||
|
@filesets = split(/,/,join(',',@filesets));
|
||||||
|
|
||||||
$ENV{PATH} = "/usr/bin";
|
$ENV{PATH} = "/usr/bin";
|
||||||
|
|
||||||
|
@ -13,6 +19,7 @@ $log->autoflush(1);
|
||||||
my $ca = Simba::CA->new({
|
my $ca = Simba::CA->new({
|
||||||
dbi_file => $ENV{SIMBA_DB_CONN} || "$ENV{HOME}/.dbi/simba",
|
dbi_file => $ENV{SIMBA_DB_CONN} || "$ENV{HOME}/.dbi/simba",
|
||||||
fh_log => $log,
|
fh_log => $log,
|
||||||
|
(@filesets ? ( filesets => \@filesets ) : ()),
|
||||||
});
|
});
|
||||||
|
|
||||||
$ca->run();
|
$ca->run();
|
||||||
|
|
|
@ -49,6 +49,15 @@ sub new {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$self->{targets} = $self->{dbh}->selectall_arrayref("select * from filesets", { Slice => {} });
|
$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 ($ENV{HOME} =~ m{([/\w]*)}) {
|
||||||
if (-f "$1/.ssh/id_rsa") {
|
if (-f "$1/.ssh/id_rsa") {
|
||||||
if (my $st = stat("$1/.ssh/id_rsa")) {
|
if (my $st = stat("$1/.ssh/id_rsa")) {
|
||||||
|
|
Loading…
Reference in New Issue