in reply to Re: Perl Threads
in thread Perl Threads
#!/usr/bin/perl -w use strict; my ($output); eval { local $SIG{ALRM} = sub {die "SSH timeout\n"}; alarm 15; $output = `/usr/bin/ssh -o ConnectTimeout=10 host.domain.com`; alarm 0; }; if ($@) { print "SSH timed out\n"; } else { print "SSH didn't time out\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Threads
by ikegami (Patriarch) on Nov 06, 2007 at 22:40 UTC |