fixed multiple expiration rules by sorting them
[sysadmin-cookbook] / recepies / zfs / zfs-expire-snapshot.pl
index 6de3cce..04c6acd 100755 (executable)
@@ -10,12 +10,13 @@ my $debug = 0;
 
 my $config = {
        'default' => {
-               14 => 5,
+               21 => 5,
                30 => 10,
                60 => 30,
        },
        '212052' => {   # koha-dev
                7 => 10,
+               14 => 30,
        },
        '212056' => {   # webpac2
                7 => 5,
@@ -56,7 +57,7 @@ while(<$fs>) {
 
        my $keep_every_days;
        my $older_than_days;
-       foreach ( keys %$c ) {
+       foreach ( sort keys %$c ) {
                $older_than_days = $_;
                $keep_every_days = $c->{$_};
                warn "## $host $age > $older_than_days" if $debug;