views:

78

answers:

1

I'm using ruby on rails 2.3.8 and I'm kind of knew at this technology. I'm using Windows 7, but I'm planning to hire a Linux hosting soon.

I'd like to know how to build processes that runs every night for things such as: checking stuff in the db, update values, send newsletter emails, etc.

+1  A: 

for "executing every night" try to read more on "crontab"

and read more on "writing rake tasks" (that are *.rake files in /lib/tasks subdir of your Rails app) for the Rails-part of your questions

your nightly crontab job will look like:

0 2 * * * cd /path/to/rails && rake db:check:stuff

note that's not a command line, don't try to execute these asterisks :) it says to execute something at 2:00 AM every night

personally I like rake tasks, but you may just use script/runner for your tasks:

0 2 * * * cd /path/to/rails && ./script/runner my_script.rb
zed_0xff
Thank you. I'll read more about this. Is there any way to test these processes on windows?
Brian Roisentul
look for win32 crontab implementation, I believe cygwin tree has at least one
zed_0xff