You are viewing a read-only archive of the Blogs.Harvard network. Learn more.
Skip to content

Poor Mans Multithreading

for i in `ls urls_*`; do ruby dns.rb $i & done

#main section from dns.rb

ip_addresses.each {|id,url|
begin
host = parse_host(url)
ip = get_ip(host)
if not ip.nil?
addresses = Ipaddress.new
addresses.address = ip
addresses.review_id = id
addresses.save
end
rescue Exception=> e
results.write("#{e},#{id},#{host}\r\n")
end
}

Post a Comment

You must be logged in to post a comment.