Tasks run in parallel on all matching servers, if you have a task that you need to only run on any one of the servers, like maybe a rake task that changes data in the db, you only need one server to run that command
You can create a role with one server as suggested, you can also pass :once => true to the run or sudo comand run 'my command', :once => true It will only run on the first matching server. out = capture 'my command' logger.info out Would do the same thing, but I would only use that form if you wanted to do something with the output than just echo it back to the console. On Jul 21, 2011, at 5:19 AM, Lee Hambley <[email protected]> wrote: > Eric, > > > I am trying to figure out how to get a task to only fire one time. > > Tasks run once, they shouldn't run "once per server" they do run "once on > each server" > > If you then have a task that should run on only one server in your group, you > need to isolate it somehow, name it with a responsibility, or give it a tag, > such as how the default recipe names a primary DB server. > -- > * 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 -- * 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
