I worked on a project that tried to use DelayedJob to schedule future items. It sucked.
Instead I recommend you use the whenever gem:
http://github.com/javan/whenever
Whenever is a Ruby gem that provides a
clear syntax for defining cron jobs.
It outputs valid cron syntax and can
even write your crontab file for you.
It is designed to work well with Rails
applications and can be deployed with
Capistrano. Whenever works fine
independently as well.
Code looks like this (from github)
every 3.hours do
runner "MyModel.some_process"
rake "my:rake:task"
command "/usr/bin/my_great_command"
end
every 1.day, :at => '4:30 am' do
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
end
every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot
runner "SomeModel.ladeeda"
end
every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday
runner "Task.do_something_great"
end
Here's a RailsCast video on how to use it.
And the corresponding ASCIICast.