Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created July 24, 2014 07:01
Show Gist options
  • Save kaosf/3d78f24d4da9b290fa0d to your computer and use it in GitHub Desktop.
Save kaosf/3d78f24d4da9b290fa0d to your computer and use it in GitHub Desktop.
cron + curl with only Ruby
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, '')
source 'https://rubygems.org'
gem 'clockwork'
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