/[cricket]/parse_df.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

Diff of /parse_df.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by dpavlin, Fri Jul 26 10:24:27 2002 UTC revision 1.11 by dpavlin, Tue May 13 16:00:53 2003 UTC
# Line 39  sub parse_df { Line 39  sub parse_df {
39                  return if (defined $df);                  return if (defined $df);
40                  print STDERR " [cache miss] ";                  print STDERR " [cache miss] ";
41          }          }
42          open(DF,"$ssh df -klP |") || die "$ssh df: $!";          eval {
43                    local $SIG{ALRM} = sub { die "ssh timeout\n"; };
44                    alarm 10;       # wait for ssh to connect and return first line
45                    open(DF,"$ssh df -klP |") || die "$ssh df: $!";
46            };
47            print STDERR " read DF eof=",eof(DF);
48          while(<DF>) {          while(<DF>) {
49                  chomp;                  chomp;
50                  my ($node,$total,$used,$aval,$use_pcnt,$mount) = split(/\s+/,$_,6);                  my ($node,$total,$used,$aval,$use_pcnt,$mount) = split(/\s+/,$_,6);
# Line 51  sub parse_df { Line 56  sub parse_df {
56                  }                  }
57          }          }
58          close(DF);          close(DF);
59            alarm 0;        # turn alarm off
60          $cache->set( $ssh, $df, "1 min" ) if ($USE_CACHE);          $cache->set( $ssh, $df, "1 min" ) if ($USE_CACHE);
61  }  }
62    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.26