mirror of https://github.com/jimsalterjrs/sanoid
Merge 1c6d7d6459 into dbcaeef1ac
This commit is contained in:
commit
9354ce8c78
36
sanoid
36
sanoid
|
|
@ -144,6 +144,33 @@ if ($args{'cron'}) {
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
||||||
|
####################################################################################
|
||||||
|
####################################################################################
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
sub get_active_datasets {
|
||||||
|
my ($config, $snaps, $snapsbytype, $snapsbypath) = @_;
|
||||||
|
#my %datestamp = get_date();
|
||||||
|
#my $errlevel = 0;
|
||||||
|
#my $msg;
|
||||||
|
#my @msgs;
|
||||||
|
my @paths;
|
||||||
|
|
||||||
|
foreach my $section (keys %config) {
|
||||||
|
if ($section =~ /^template/) { next; }
|
||||||
|
if (! $config{$section}{'autoprune'}) { next; }
|
||||||
|
if (! $config{$section}{'autosnap'}) { next; }
|
||||||
|
if ($config{$section}{'process_children_only'}) { next; }
|
||||||
|
|
||||||
|
my $path = $config{$section}{'path'};
|
||||||
|
push @paths, $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @sorted_paths = sort { lc($a) cmp lc($b) } @paths;
|
||||||
|
my $paths = join (" ", @sorted_paths);
|
||||||
|
return $paths
|
||||||
|
}
|
||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
####################################################################################
|
####################################################################################
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
|
@ -883,10 +910,17 @@ sub getsnaps {
|
||||||
print "INFO: cache expired - updating from zfs list.\n";
|
print "INFO: cache expired - updating from zfs list.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# just get snapshots from configured datasets to not spin up the disks
|
||||||
|
open FH, "$zfs get -Hrpt snapshot creation ".get_active_datasets(@params)." |";
|
||||||
|
@rawsnaps = <FH>;
|
||||||
|
close FH;
|
||||||
|
$exit_code = $? >> 8;
|
||||||
|
if ($exit_code != 0) {
|
||||||
|
print "INFO: zfs list shapshots with dataset names does not work.. retrying without dataset names (this will spin-up all disks)\n";
|
||||||
open FH, "$zfs get -Hrpt snapshot creation |";
|
open FH, "$zfs get -Hrpt snapshot creation |";
|
||||||
@rawsnaps = <FH>;
|
@rawsnaps = <FH>;
|
||||||
close FH;
|
close FH;
|
||||||
|
}
|
||||||
open FH, "> $cache.tmp" or die "Could not write to $cache.tmp!\n";
|
open FH, "> $cache.tmp" or die "Could not write to $cache.tmp!\n";
|
||||||
print FH @rawsnaps;
|
print FH @rawsnaps;
|
||||||
close FH;
|
close FH;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue