Skip to content

Instantly share code, notes, and snippets.

@zackchandler
Created December 22, 2010 22:47
Show Gist options
  • Save zackchandler/752230 to your computer and use it in GitHub Desktop.
Save zackchandler/752230 to your computer and use it in GitHub Desktop.
require 'timeout'
def block_until_instance_is_sshable!(timeout=120)
start = Time.now
while ((Time.now - start) < timeout) do
begin
Timeout::timeout(5) {
# INSERT CODE HERE TO TRY TO SSH
return true
}
rescue Timeout::Error
next
end
end
false
end
result = block_until_instance_is_sshable!(10)
puts result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment