Here is a brief tutorial explaining how to use the whenever gem to managed scheduled jobs in a rails app.
It was tested with whenever version 0.9.2 and rails version 4.0.4.
First, add the whenever gem to your Gemfile.
gem 'whenever', :require => false
Next, from your application's root directory, run "wheneverize."
$ wheneverize .
This will create a scheduler file, config/schedule.rb.
Next, configure your scheduler file to run your jobs according to the appropriate schedule.
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") set :path, Rails.root set :output, Rails.root.join('log', 'cron.log') every 1.day do runner "Customer.email_happy_birthday" end
The whenever gem converts your pretty defined-with-ruby jobs into crontab.
To check how config/schedule.rb converts ton cron syntax, run this command:
Then finally, in order to update your crontab: