Basically, just use the http library to see if you can (in fact, HEADing will be better) on the page they point to. If you get a response, then the server will stop, otherwise (it does not respond or the timeout expires) it does not work, and you warn the user accordingly.
This is not the cleanest way to do this, but basically:
require 'net/http'
require 'uri'
def isUp( url )
uri = URI.parse( url )
begin
Timeout::timeout(5) {
Net::HTTP.start( uri.host, uri.port ) { |http|
http.head( uri.path )
}
}
rescue Timeout::Error
return false
end
return true
end
, / , , , .