I’ve seen lots of different approaches to scheduling jobs with Rails, including a great run down by Ryan Bates’ Rails Casts Episode 129, however the most elegant solution I’ve seen so far is what was outlined in Episode 164 using the cool Whenever gem and good ol’ Cron.
Within a couple of hours I had a weekly scheduled job running all nicely managed entirely through my Rails application code base. The incorporation into Capistrano makes it killer. The only thing that caught me out was that my script/runner file was not set as executable when capistrano was deploying it, therefore runner commands failed to execute through Cron with a “permission denied” error.
Found that all I needed to do was set it to executable within svn:
svn propset svn:executable on script/runner
All good!