Created
July 24, 2014 07:01
-
-
Save kaosf/3d78f24d4da9b290fa0d to your computer and use it in GitHub Desktop.
cron + curl with only Ruby
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 'rubygems' | |
require 'clockwork' | |
include Clockwork | |
require 'net/http' | |
require 'uri' | |
handler do |job| | |
res = Net::HTTP.get_response URI.parse('http://foobar') | |
puts "#{Time.now},#{res.code}" | |
end | |
every(59.minutes, '') |
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
source 'https://rubygems.org' | |
gem 'clockwork' |
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
bundle install | |
bundle exec clockwork clock.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment