in reply to Re: Net::OpenSSH fastest way to reconnect to a rebooted machine?
in thread Net::OpenSSH fastest way to reconnect to a rebooted machine?
What you've described is exactly what I'm trying to figure out how to do. The question is how do I test that the connection has either succeeded or failed? I tried this, since the Net::OpenSSH documentation says that a failure returns undef or an empty list:
$ssh{$host} = Net::OpenSSH->new($host, master_opts => [-i => "/path/t +o/key"]); if(defined $ssh{$host}) { print STDOUT "SSHD is back up. Continuing...\n"; } else { print STDOUT "Still waiting for SSH. Retrying in 5 seconds...\n" +; sleep 5; }
This fails though. Apparently the "no route to host" message that comes back from the failed connection attempt is enough to define $ssh{$host}. What's a good way to test to see if the connection is successful?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Net::OpenSSH fastest way to reconnect to a rebooted machine?
by salva (Canon) on May 17, 2011 at 20:26 UTC | |
by regan99 (Initiate) on May 17, 2011 at 21:26 UTC | |
|
Re^3: Net::OpenSSH fastest way to reconnect to a rebooted machine?
by Anonymous Monk on Nov 19, 2012 at 16:49 UTC |