Created
May 15, 2014 20:13
-
-
Save wstrinz/cbdf6fb46fe09370d678 to your computer and use it in GitHub Desktop.
This file contains 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 'open-uri' | |
require 'active_support/time' | |
url = ARGV[0] || 'http://www.google.com' | |
interval_minutes = ARGV[1] || 5 | |
loop do | |
puts "#{Time.now} - getting #{url}\n\n" | |
begin | |
puts open(url).read | |
rescue | |
puts "failed to read #{url}!!!!" | |
end | |
puts "\n\nsleeping #{interval_minutes} minutes, until #{Time.now + interval_minutes.minutes}" | |
sleep(interval_minutes.minutes) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment