diff --git a/backup b/backup index 5dba178..5b6eeee 100755 --- a/backup +++ b/backup @@ -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(); diff --git a/lib/Simba/CA.pm b/lib/Simba/CA.pm index 123e218..2c5c8a9 100644 --- a/lib/Simba/CA.pm +++ b/lib/Simba/CA.pm @@ -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")) {