[Rails] Re: background task
Hi John,
What I usually do in cases like yours is that I'll create a runnable
script that is run using rails runner (like $ ./script/rails runner -e
production ./script/fetch_save_foo.runnable), and then use cron to run
that script on some ongoing basis (where I typically have a crontab
per project where all cron'd events related to that project are kept).
The ability to easily develop/test/run scripts using your existing
app's models/etc via runner (using the same exact calls you would/
could make in console) is one of the nicest built-in features of
rails.
Jeff
On Jul 24, 1:45 pm, John Sayeau <li...@ruby-forum.com> wrote:
> Alpha Blue wrote in post #1012740:
>
> > You can implement a rake task that builds the data and initiate the task
> > using CRON.
>
> > "However, it really depends on what your idea of accumulated data is to
> > be honest. "
>
> The data is environmental. I want to be able to take a reading of
> temperature, humidity and pressure at regular intervals. The interval
> could be minutes or seconds.
>
> I'm not sure it even has to be part of the rails app. It just has to
> update activerecord. What I was hoping was that there was a way to start
> this process at the same time as the rails app. I guess I could have a
> startup script that starts both.
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
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@googlegroups.com.
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home