Ernesto,

There's no way to infer the name of the server once the connection is made,
you should distinguish it somehow like

role :app, 'my.server.com', :background_worker => true
role :app, %w[my.other.servers can.go.in this.list.here]

Then in your code:

task :something_only_on_one_server, :roles => [:app], :only =>
{:background_worker => true} do
  # something nice here.
end

-- Lee Hambley

Twitter: @leehambley | @capistranorb
Blog: http://lee.hambley.name/
Working with Rails: http://is.gd/1s5W1


On 26 February 2010 14:30, etagwerker <[email protected]> wrote:

> hi all,
>
> i am deploying a rails app to a cluster and i'd like to do something
> specific for only one of the application nodes in my cluster.
>
> something like this: http://gist.github.com/315706
>
> i have certain background task that i want to run, but only in one of
> the nodes. right now it is running in all of the nodes.
>
> is there a 'local' variable in the after method that i can use to see
> in which node i am?
>
> i wrote some code in that gist to show what i am trying to do. if
> there is a better way in capistrano, please let me know.
>
> thanks!
>
> - ernesto
>
> --
> * You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected]<capistrano%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/capistrano?hl=en

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to