Skip to content

Commit

Permalink
updated checkbackup to work with new JNX::ZFS interface and it works …
Browse files Browse the repository at this point in the history
…with a host commandline option now as well
  • Loading branch information
jollyjinx committed Jan 31, 2014
1 parent d5d2cb1 commit 004e82e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions checkbackup.perl
Expand Up @@ -11,27 +11,37 @@

use JNX::Configuration;

my %commandlineoption = JNX::Configuration::newFromDefaults( {
'datasets' => ['puddle','string'],
'snapshotinterval' => [300,'number'],
'snapshottime' => [10,'number'],
my %commandlineoption = JNX::Configuration::newFromDefaults( {
'host' => ['','string'],
'hostoptions' => ['-c blowfish -C -l root','string'],

'datasets' => ['puddle','string'],
'snapshotinterval' => [300,'number'],
'snapshottime' => [10,'number'],

'verbose' => [0,'flag'],
'debug' => [0,'flag'],
}, __PACKAGE__ );

use strict;
$commandlineoption{verbose}=1 if $commandlineoption{debug};

use strict;
use JNX::ZFS;
use JNX::System;


my %host = ( host => $commandlineoption{host}, hostoptions => $commandlineoption{hostoptions}, debug=>$commandlineoption{debug},verbose=>$commandlineoption{verbose});

JNX::System::checkforrunningmyself($commandlineoption{'datasets'}) || die "Already running which means lookup for snapshots is too slow";

my $lastwaketime = JNX::System::lastwaketime();
my @datasetstotest = split(/,/,$commandlineoption{'datasets'});
my @datasetstotest = split(/,/,$commandlineoption{'datasets'});

for my $datasettotest (@datasetstotest)
{
print STDERR "Testing dataset: $datasettotest\n";

my @snapshots = JNX::ZFS::getsnapshotsfordataset($datasettotest);
my @snapshots = JNX::ZFS::getsnapshotsfordataset(%host,dataset=>$datasettotest);
# print STDERR "Snapshots: @snapshots\n";

my $snapshottime = JNX::ZFS::timeofsnapshot( pop @snapshots );
Expand Down

0 comments on commit 004e82e

Please sign in to comment.