- I need to create a daemon process that runs periodically in the background on a server and creates some export files from a database. - I''d like to write it in Ruby and use ActiveRecord & ERB. - Conveniently enough, I''m actually working on an RoR app that will be deployed on this server, against the same database, within a few months. So I might as well go ahead with a full RoR install on the server--no need to pick and choose gems. - This daemon process I want to create now really is not connected to that app, and so should live entirely outside that app''s directory structure. I think it''s that last point that I don''t quite know what to do about. My standalone daemon would, I guess, require ActiveXXX and a model.rb file (or 2 or 3). Or perhaps no model file, just define the model classes inline. (This daemon could easily fit in a single source file; the model files will basically be empty.) Thoughts? -- Scott Ribe scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org http://www.elevated-dev.com/ (303) 722-0567 voice -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
On Sat, Jun 30, 2012 at 8:10 AM, Scott Ribe <scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org> wrote:> - I need to create a daemon process that runs periodically in the background on a server and creates some export files from a database.A "daemon" process runs continuously; are you sure you don''t just want to use cron? It''s made for "periodically" :-)> - I''d like to write it in Ruby and use ActiveRecord & ERB.If cron is an option, you could either write a standalone script, a rake task or use a full Rails installation and `rails runner`. FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
On 30 June 2012 16:10, Scott Ribe <scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org> wrote:> - I need to create a daemon process that runs periodically in the background on a server and creates some export files from a database. > > - I''d like to write it in Ruby and use ActiveRecord & ERB. > > - Conveniently enough, I''m actually working on an RoR app that will be deployed on this server, against the same database, within a few months. So I might as well go ahead with a full RoR install on the server--no need to pick and choose gems. > > - This daemon process I want to create now really is not connected to that app, and so should live entirely outside that app''s directory structure. > > I think it''s that last point that I don''t quite know what to do about. My standalone daemon would, I guess, require ActiveXXX and a model.rb file (or 2 or 3). Or perhaps no model file, just define the model classes inline. (This daemon could easily fit in a single source file; the model files will basically be empty.)If the code is fetching data from the database then put most of the code in the model in the rails app and run it with a rake task, possibly from cron. By putting it in the model you can test the methods using the rails tests. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.