/[sysadmin-cookbook]/recepies/zfs/zfs-expire-snapshot.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/zfs/zfs-expire-snapshot.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 107 - (hide annotations)
Sat Jun 6 13:21:07 2009 UTC (14 years, 10 months ago) by dpavlin
File MIME type: text/plain
File size: 435 byte(s)
calculate age of snapshot in days

1 dpavlin 107 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5    
6     use DateTime;
7    
8     my $now = DateTime->now();
9    
10     open(my $fs, '-|', 'zfs list -H');
11     while(<$fs>) {
12     chomp;
13     my ( $name, $used, $avail, $refer, $mountpoint ) = split(/\t/,$_,6);
14    
15     next unless $name =~ m{@(\d\d\d\d)-(\d\d)-(\d\d)};
16    
17     my $date = DateTime->new( year => $1, month => $2, day => $3 );
18     my $age = $now->delta_days( $date );
19    
20     warn "$name $used $refer [", $age->delta_days, " days]\n";
21     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26