diff --git a/sanoid b/sanoid index 895ede3..c052e1c 100755 --- a/sanoid +++ b/sanoid @@ -144,6 +144,33 @@ if ($args{'cron'}) { 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 +} + #################################################################################### #################################################################################### #################################################################################### @@ -884,7 +911,7 @@ sub getsnaps { } } # just get snapshots from configured datasets to not spin up the disks - open FH, "$zfs get -Hrpt snapshot creation ".join(" ",keys %$config)." |"; + open FH, "$zfs get -Hrpt snapshot creation ".get_active_datasets(@params)." |"; @rawsnaps = ; close FH; $exit_code = $? >> 8;