Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (56 sloc) 2.4 KB
Rails plugin to integrate with the Quartz scheduling library.
This plugin consists of a ServletContextListener which initializes the Quartz
scheduler, and a QuartzJob able to run arbitrary Ruby code in the JRuby/Rails
The SVN repository of this plugin is located at
Get Quartz
The Quartz java library ( is part of the
JBoss distribution, so in case this is your platform of choice, you're ready to
go, no need to install it a second time.
Otherwise, go download Quartz from
( and place the jar
somewhere so it ends up in WEB-INF/lib inside your war file. With Warbler, your
application's lib/ dir is a good choice as it will be picked up from there
The plugin is in production use with Quartz version 1.5.2, as delivered with
JBoss 4.2.1, but more recent versions should work, too.
Install the ContextListener
add the following to your web.xml:
Configure your Jobs
First, give your job a name. We'll use 'yourJob' here as an example. Then, add
two context parameters to your web.xml (i.e. by modifying
RAILS_ROOT/config/web.xml.erb if you're using warbler to package your
<param-value>0 * * * * ?</param-value>
The first parameter tells Quartz to run the do_stuff method of class
YourJobClass, and the second tells it to do so every minute. For documentation
and more examples of the cron pattern syntax please view the quartz project
documentation, i.e. this page:
You can have as many jobs declared like this as you like.
Building from source
To build the java source code, copy servlet-api.jar (not included here because
I'm not sure of the licensing terms, but it is delivered with your app server)
to dependencies/ and run jrake.
Author, Credits
Created by: Jens Krämer,