Skip to content
Snippets Groups Projects
Commit 8719d7a3 authored by Sergey Joseph Ivanov's avatar Sergey Joseph Ivanov
Browse files

check counts for snapshots

parent 84b2ad9b
No related branches found
No related tags found
No related merge requests found
......@@ -57,23 +57,23 @@ sub handler {
my ($when,$age) = (0,`date '+%s'`);
chomp $age; $age -= $when;
my $line = '';
my ($count,$list);
my $LIST = "/usr/sbin/zfs list -H -p -o creation -S creation -d 1 -t snapshot $zfs 2>&1";
open (my $list, "-|", $LIST)or die "can't run $LIST: $!";
while (<$list>) {
open ($list, "-|", $LIST)or die "can't run $LIST: $!";
=pod
1469459040
=cut
chomp;
if (($_ = <$list>) && ($_ =~ m/^(\d+)$/)){
$when = $1;
$age = `$DATE '+%s'` - $when;
$line = $_ if $_;
if (/^(\d+)$/){
$when = $1;
$age = `$DATE '+%s'` - $when;
last;
}
while ( <$list> ) {};
$count = $.;
}
return {
"age" => [$age, "i"],
"line" => [$line, "s"]
"age" => [$age, "i"],
"count" => [$count, "i"],
"line" => [$line, "s"]
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment