Created
September 1, 2010 14:39
-
-
Save numbcoder/560768 to your computer and use it in GitHub Desktop.
cron scheduler
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 'rufus/scheduler' | |
scheduler = Rufus::Scheduler.start_new | |
scheduler.in '20m' do | |
puts "order ristretto" | |
end | |
scheduler.at 'Thu Mar 26 07:31:43 +0900 2009' do | |
puts 'order pizza' | |
end | |
# == corn '* * * * *' | |
# minutes: 0-59 | |
# hours: 0-23 | |
# dayOfMonth: 1-31 | |
# month: 1-12 | |
# dayOfWeek: 0-7 (0 and 7 is Sunday) | |
scheduler.cron '0 22 * * 1-5' do | |
# every day of the week at 22:00 (10pm) | |
puts 'activate security system' | |
end | |
scheduler.every '5m' do | |
puts 'check blood pressure' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment