Best way to execute timed actions?


#1

I’ve seen this come up a few times before on this list but never felt
it got a satisfactory answer. What is the best way to execute timed
actions? Examples include sending an email each week, calculating
interest each day, or cleaning up your database or server files.

This wiki page has some ideas, but these seem a bit extreme.
http://wiki.rubyonrails.com/rails/pages/HowToRunBackgroundJobsInRails

I’ve also seen people suggest using cron to execute script/runner:
script/runner -e production “Model.some_method()”

It seems to me you could also have cron execute a wget to a page like:
wget http://www.domain.com/controller/action/id

And I vaguely remember someone saying they were working on a better
solution (as a plugin?).

What are people actually using? What works best?

Thanks,
Kevin S.


#2

On 1/19/06, Kevin S. removed_email_address@domain.invalid wrote:

It seems to me you could also have cron execute a wget to a page like:
wget http://www.domain.com/controller/action/id

And I vaguely remember someone saying they were working on a better
solution (as a plugin?).

What are people actually using? What works best?

Personally I just use cron, rather than what is suggested in that Wiki
page.
The cron task runs a script that requires …/config/boot.rb, and then
away it goes.

This is probably the plugin you were thinking of, and it does look cool:
http://opensvn.csie.org/rails_cron/trunk/README