README.rdoc in rufus-scheduler-2.0.19 vs README.rdoc in rufus-scheduler-2.0.20
- old
+ new
@@ -96,17 +96,23 @@
The timezones are the ones supported by the 'tzinfo' rubygem (http://tzinfo.rubyforge.org/).
The timezone support was contributed by Tanzeeb Khalili.
-Since 2.0.9, "monthdays" are supported
+"monthdays" are supported
scheduler.cron '0 22 * * sun#1,sun#2' do
# every first and second sunday of the month, at 22:00
end
+It's also OK (since 2.0.19) to use L (for last monthday) or negative numbers.
+ scheduler.cron '0 22 * * sun#-1' do
+ # every last sunday of the month, at 22:00
+ end
+
+
== scheduler.join
Note that if you have a tiny script like this one :
require 'rubygems'; require 'rufus-scheduler'
@@ -130,10 +136,22 @@
=== important note about #join
DO NOT CALL this #join method if you're running rufus-scheduler from Rails or Sinatra or any application that's already some kind of 'daemon'. It's not necessary! #join is meant for small standalone scripts.
+== schedule.stop
+
+ scheduler.stop
+
+This call stops the scheduler. It doesn't unschedule jobs. If there are running jobs, they're left running.
+
+If you need to stop the scheduler and wait for all the jobs currently running to finish (without killing them), rufus-scheduler 2.0.20 brings a new :terminate => true option.
+
+ scheduler.stop(:terminate => true)
+ # returns once all the jobs have been unscheduled and no jobs is running
+
+
== block parameters
Scheduled blocks accept 0 or 1 parameter (this unique parameter is the job
instance itself).
@@ -317,11 +335,11 @@
The chronic gem may help (http://chronic.rubyforge.org/) :
require 'chronic' # sudo gem install chronic
scheduler.every '3h', :first_at => Chronic.parse('this tuesday 5:00') do
- # do something starting this tueday
+ # do something starting this tuesday
end
Note : setting a :first_at/:first_in in the past will get rufus-scheduler to trigger for all the past schedules until now. Adding :discard_past => true will prevent this.
@@ -518,11 +536,20 @@
puts "caught exception '#{exception}'"
end
Note that an every job or a cron job will stay scheduled even if it experiences an exception.
+By default, all exceptions are rescued. It's easy to customize that behaviour :
+ scheduler = Rufus::Scheduler::PlainScheduler.start_new(:exception => StandardError)
+ # or
+ #scheduler = Rufus::Scheduler::EmScheduler.start_new(:exception => StandardError)
+
+ scheduler.in "3s" do
+ exit
+ end
+
== frequency
The default frequency for the scheduler is 0.330 seconds. This means that the usual scheduler implementation will wake up, trigger jobs that are to be triggered and then go back to sleep for 0.330 seconds. Note that this doesn't mean that the scheduler will wake up very 0.330 seconds (checking and triggering do take time).
You can set a different frequency when starting / initializing the scheduler :
@@ -553,11 +580,11 @@
}
== with Passenger
-"it terminates for no apparent reason !"
+"it terminates for no apparent reason!"
https://github.com/jmettraux/rufus-scheduler/issues/issue/10
== tested with
@@ -574,27 +601,40 @@
The 'tzinfo' rubygem.
The ruby gem 'eventmachine' if you use Rufus::Scheduler::EmScheduler, else no other dependencies.
-== mailing list
+== support
+If you identify and pinpoint a bug, please use the issue tracker. If you are unsure whether the fault lies in rufus-scheduler or in your software, use the mailing list. The mailing list is Google-powered, so, yes, you can search it.
+
+Please read carefully: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html (then re-read it).
+
+
+=== mailing list
+
On the rufus-ruby list :
http://groups.google.com/group/rufus-ruby
+Newcomers' first message is held for moderation in order to prevent spam. Further messages are not held.
-== issue tracker
-http://rubyforge.org/tracker/?atid=18584&group_id=4812&func=browse
+=== issue tracker
+https://github.com/jmettraux/rufus-scheduler/issues
-== irc
+=== irc
+
+If you come over to #ruote to ask for rufus-scheduler help, please make sure to 1) say hello 2) be polite 3) state that you're looking for rufus-scheduler help 4) remember that we cannot read your mind and guess whatever lies in your deployment.
+
irc.freenode.net #ruote
+If there is no answer on IRC, use the mailing list.
+
== source
http://github.com/jmettraux/rufus-scheduler
git clone git://github.com/jmettraux/rufus-scheduler.git
@@ -616,5 +656,6 @@
== license
MIT
+