Skip to content

Instantly share code, notes, and snippets.

@wstrinz
Created May 15, 2014 20:13
Show Gist options
  • Save wstrinz/cbdf6fb46fe09370d678 to your computer and use it in GitHub Desktop.
Save wstrinz/cbdf6fb46fe09370d678 to your computer and use it in GitHub Desktop.
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