in reply to Re^2: Net::OpenSSH fastest way to reconnect to a rebooted machine?
in thread Net::OpenSSH fastest way to reconnect to a rebooted machine?

Use the error method to see if some error happened.
for my $host (...) { $ssh{$host} = Net::OpenSSH->new($host, ...); if($ssh{$host}->error) { print STDOUT "Still waiting for SSH. Retrying in 5 seconds...\ +n"; sleep 5; redo; } else { print STDOUT "SSHD is back up. Continuing...\n"; } }

If you are starting several connections in parallel, you can also use the wait_for_master method.

Replies are listed 'Best First'.
Re^4: Net::OpenSSH fastest way to reconnect to a rebooted machine?
by regan99 (Initiate) on May 17, 2011 at 21:26 UTC

    That worked! Thanks for the reply (and the great module).