--- parse_df.pl 2002/07/26 10:24:27 1.9 +++ parse_df.pl 2002/09/12 14:58:44 1.10 @@ -39,8 +39,14 @@ return if (defined $df); print STDERR " [cache miss] "; } - open(DF,"$ssh df -klP |") || die "$ssh df: $!"; + eval { + local $SIG{ALRM} = sub { die "ssh timeout\n"; }; + alarm 10; # wait for ssh to connect and return first line + open(DF,"$ssh df -klP |") || die "$ssh df: $!"; + }; + print STDERR " read DF eof=",eof(DF); while() { + alarm 0; # turn alarm off chomp; my ($node,$total,$used,$aval,$use_pcnt,$mount) = split(/\s+/,$_,6); if ($use_pcnt && $use_pcnt =~ s/(\d+)%/$1/) {