Raven
October 10, 2007, 11:30am
1
Hi!
I’m building a small site and I wish to fill the data in the database
nightly via cron. What is best practice here? Do I:
have cron do a normal web request to /nightRunner/doIt?
build a maintenance script and place it somewhere (where?) that
have access to the models and database and call it via script/runner?
Thanks.
Raven
October 10, 2007, 11:33am
2
On 10 Oct 2007, at 10:29, Raven wrote:
Hi!
I’m building a small site and I wish to fill the data in the database
nightly via cron. What is best practice here? Do I:
have cron do a normal web request to /nightRunner/doIt?
build a maintenance script and place it somewhere (where?) that
have access to the models and database and call it via script/runner?
urgh.
Yes. we typically have a cron_jobs folder with (you guessed it)
cron jobs
Sticking
#!/usr/bin/env ruby
require File.dirname(FILE ) + ‘/…/config/boot’
require File.dirname(FILE ) + ‘/…/config/environment’
ActiveRecord::Base.establish_connection
at the top should get all the rails stuff setup for you
Fred
Raven
October 10, 2007, 2:33pm
3
Or you can run your cron script with script/runner
On 10/10/07, Frederick C. [email protected] wrote:
build a maintenance script and place it somewhere (where?) that
require File.dirname(FILE ) + ‘/…/config/boot’
require File.dirname(FILE ) + ‘/…/config/environment’
ActiveRecord::Base.establish_connection
at the top should get all the rails stuff setup for you
Fred
–
Cheers!