Wednesday, June 23, 2010

Ruby on Rails: Use cron job to do automatic refresh

Offline rebuild the Xapian Indexes
1. Goto directory
2. To get into the cron and set your schedule

crontab -e



* * * * * cd /var/www/rails_app && /usr/bin/rake xapian:rebuild_index models="Post"

(Note: rebuild index every minute)

Automatic refresh Ruby file
1. Goto directory
2. To get into the cron and set your schedule

crontab -e


* * * * * /usr/bin/ruby /var/www/rails_app/script/runner /var/www/rails_app/
app/dotask.rb

or

* * * * * /usr/bin/ruby /var/www/rails_app/app/dotask.rb

(Note: Make sure is the correct directory)

Related Link:
http://seanbehan.com/
http://www.hostingrails.com/

No comments:

Post a Comment