Skip to content

Instantly share code, notes, and snippets.

@soulware
Created January 22, 2010 01:30
Show Gist options
  • Save soulware/283421 to your computer and use it in GitHub Desktop.
Save soulware/283421 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rufus-scheduler'
# the following example should poll every 5s
# and trigger a job at seconds 0,10,20,30,40,50
# but no jobs ever fire unless we are very lucky with our timing
scheduler = Rufus::Scheduler::PlainScheduler.start_new(:frequency => 5.0)
scheduler.cron "0,10,20,30,40,50 * 0-59 * * *" do
puts "doing something #{Time.now}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment