scheduled tasks on rails

I usually do something pretty simple: I create a class in the vendor directory, and then setup a cron job to run script\runner with that file. For example:

I have a file called session_cleaner.rb in \vendor like this:

class SessionCleaner   CGI::Session::ActiveRecordStore::Session.destroy_all( ['updated_at < ?', 240.minutes.ago] ) end

Then I have a cron job that runs:

ruby script\runner SessionCleaner -e production

I've also used this method for nightly emails to process new user signups, etc.

Dave http://www.gotossh.com - web based SSH http://www.stevensonsoftware.com - affordable VPS hosting