Ruby
How to run a rake task from cron
2010-04-21, Nortan Posted in Ruby, Programming | 我来说两句 | 查看全文>>
Say you want to do run some stats on your Ruby on Rails application nightly. Create a rake task to do what you want then use cron to execute it.
1.Preflight information
First we need to create the RoR application.
rails cron cd cron script/generate model my_model vi config/database.yml (set the database username/password, and databases created in your environment)
2. Creating the rake task(s)
2.1 Simple task
First lets see how to call any ruby code from rake. Rake code is placed in lib/tasks/FILENAME.rake. So lets create a lib/tasks/cron.rake and place this code in it: 查看全文…
Rails apps auto generate sitemap
2010-04-15, Nortan Posted in Ruby, Programming | 8 回复 | 查看全文>>
标签: Rails, Rails Sitemap Plugin, rails sitemap生成器, sitemap generator, 生成sitemap