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: 1) have cron do a normal web request to /nightRunner/doIt? 2) build a maintenance script and place it somewhere (where?) that have access to the models and database and call it via script/runner? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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: > 1) have cron do a normal web request to /nightRunner/doIt? > 2) build a maintenance script and place it somewhere (where?) that > have access to the models and database and call it via script/runner? >1) urgh. 2) 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Or you can run your cron script with script/runner On 10/10/07, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > 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: > > 1) have cron do a normal web request to /nightRunner/doIt? > > 2) build a maintenance script and place it somewhere (where?) that > > have access to the models and database and call it via script/runner? > > > > 1) urgh. > 2) 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 > > > >-- Cheers! - Pratik http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---