Skip to content

Instantly share code, notes, and snippets.

@lurraca
Last active December 19, 2015 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lurraca/5872705 to your computer and use it in GitHub Desktop.
Save lurraca/5872705 to your computer and use it in GitHub Desktop.
my clock.rb config
require 'clockwork'
require './config/boot'
require './config/environment'
include Clockwork
handler do |job|
puts "Running #{job}"
end
# [499, "sunday"], [500, "monday"], [498, "tuesday"], [497, "wednesday"], [504, "thursday"], [501, "friday"], [502, "saturday"]
every(1.week, 'Create Sunday Campaign', :at => 'Sunday 12:00') do
EmailAlert.perform_async(499)
end
every(1.week, 'Create Monday Campaign', :at => 'Monday 12:00') do
EmailAlert.perform_async(500)
end
every(1.week, 'Create Tuesday Campaign', :at => 'Tuesday 12:00') do
EmailAlert.perform_async(498)
end
every(1.week, 'Create Wednesday Campaign', :at => 'Wednesday 12:00') do
EmailAlert.perform_async(497)
end
every(1.week, 'Create Thursday Campaign', :at => 'Thursday 12:00') do
EmailAlert.perform_async(504)
end
every(1.week, 'Create Friday Campaign', :at => 'Friday 12:00') do
EmailAlert.perform_async(501)
end
every(1.week, 'Create Saturday Campaign', :at => 'Saturday 12:00') do
EmailAlert.perform_async(502)
end
every(1.day, 'Get Data from Google Anal') do
Popular.perform_async
end
$ clockwork clock.rb
/Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/activesupport-3.2.11/lib/active_support/duration.rb:107:in `method_missing': undefined method `public_instance_methods' for 604800:Fixnum (NoMethodError)
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/sinatra-1.4.3/lib/sinatra/base.rb:1903:in `block in register'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/sinatra-1.4.3/lib/sinatra/base.rb:1903:in `map'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/sinatra-1.4.3/lib/sinatra/base.rb:1903:in `register'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/sinatra-1.4.3/lib/sinatra/base.rb:1917:in `block (2 levels) in delegate'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/clockwork-0.5.2/lib/clockwork.rb:173:in `every'
from /Users/lurraca/Desktop/projects/pixelpt/shop.pr-web.rails/clock.rb:12:in `<top (required)>'
from /Users/lurraca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/lurraca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/gems/clockwork-0.5.2/bin/clockwork:12:in `<top (required)>'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/bin/clockwork:23:in `load'
from /Users/lurraca/.rvm/gems/ruby-1.9.3-p194@shop.pr/bin/clockwork:23:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment