W
Walle Wallen
Hey, I need a better way of checking if a webserver is online and
operational. The following code
works ok, but it sometimes returns the wrong result. Does anyone have a
better approach?
//Walle
def check_http(server)
Timeout::timeout(10.0) do
if(Net::HTTP.get_response(URI.parse("http://#{server}.something.com")).code
== "200")
return true
end
return false
end
rescue Timeout::Error
return false
rescue
return false
end
operational. The following code
works ok, but it sometimes returns the wrong result. Does anyone have a
better approach?
//Walle
def check_http(server)
Timeout::timeout(10.0) do
if(Net::HTTP.get_response(URI.parse("http://#{server}.something.com")).code
== "200")
return true
end
return false
end
rescue Timeout::Error
return false
rescue
return false
end