You can use Daemons.call instead of run.
On Feb 3, 1:07 am, joserwan
<joser...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello, I try to launch many daemons from a script written in the
> script/repository.
>
> One daemon is launched per site (AR model "Site").
> I want to load Rails environment just once.
>
> Each time a daemon is launched, script exits.
> I tried to "encapsulate" daemon launching in threads, but I have
the
> same issue.
>
> Have you any idea how to do what I want to ?
>
> my codes :
>
> without threading :
>
> (...)
> Site.all.each{|site|
> p "start #{site.name}..."
> Daemons.run("#{RAILS_ROOT}/app/daemons/proxy_client.rb",
> options.merge({:app_name => "proxy_client_#
> {site.id.to_s}", :ARGV =>[ARGV[0], ''--'',
"SITE=#
> {site.id.to_s}"]})}
>
> (...)
>
> With threading :
> (...)
> Site.all.each{|site|
> p "start #{site.name}..."
> @threads <<
Thread.new{Daemons.run("#{RAILS_ROOT}/app/daemons/
> proxy_client.rb", options.merge({:app_name => "proxy_client_#
> {site.id.to_s}",
> :ARGV =>[ARGV[0],
> ''--'', "SITE=#{site.id.to_s}"]}))
> }
> end
> @threads.each{|t| t.join}
> (...)
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---