Last active
December 21, 2015 04:38
-
-
Save rumblestrut/6250713 to your computer and use it in GitHub Desktop.
Ruby script that tests if domains are up and resolving correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/http' | |
| pages = %w( www.ericjgruber.com | |
| www.lawrencecoders.com | |
| www.americanacollectors.com | |
| www.witchesbecryin.com | |
| ) | |
| threads = [] | |
| for page in pages | |
| threads << Thread.new(page) { |myPage| | |
| h = Net::HTTP.new(myPage, 80) | |
| puts "Fetching: #{myPage}" | |
| resp, data = h.get('/', nil) | |
| puts "Got #{myPage}: #{resp.message}" | |
| } | |
| end | |
| threads.each { |aThread| aThread.join } |
Author
That works great, thanks!
Hey, where did my for loop go? :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something like this?