Scheduled Tasks with Cron in a Rails app

One of my apps requires a daily task to run. It uses WWW::Mechanize (the gem) to log onto a website, insert a username and password, and save that information, come back to my app, and insert & save that into a form on my site.

I’m pretty impressed I was able to pull it off. It’s a great deal of detail to go into, but I used Recipe 75 in Advanced Rails Recipes and adjusted some of my old hpricot & mechanize scripts.

Best of all, it keeps me out of the crontab on the server. No hand editing. The capistrano cron rake task takes care of that.

Picture of Scott Motte

delicious facebook rss twitter

Spitfire Sky | github | archives | resume