Note that :use_sudo and :runner are only used by the deployment tasks. Capistrano itself doesn't know anything about them. If you want your tasks to understand those, you'll need to do like the deployment tasks do:
as = fetch(:runner, "app") via = fetch(:run_method, :sudo) invoke_command(command, :via => via, :as => as) The :run_method variable is set by default to check :use_sudo and return :sudo if it is true, and :run otherwise. - Jamis Mason Browne wrote: > I don't know if I'm understanding your problem correctly.... but > commands will be executed by the "runner". So... in my set up, my ssh > user and my runner are the same, so I have it set to: > > set :user, "deployer" > set :runner, user > > and "deployer" in this case would have sudo privs. If you just want > to run a single command with sudo, you can go > > sudo "command string", :as => "user" > > and it will run the command as whomever is specified with ":as". > > :use_sudo is set to true by default, so commands will automatically be > run with sudo if they need them... > > :run_method will also in most cases default to :sudo, so... I really > don't know where your problem is coming from. > > Any clarification as to your actual deploy error would be great. > > On Jun 5, 2008, at 8:53 AM, magpie wrote: > >> I understand with Capistrano you're supposed to be able to script >> remote shell commands independant of whether sudo should be used and >> what user. The other day my deploy task was working fine using the run >> method as the root user. >> >> Then the sysadmin wanted me to use another user and sudo, and I >> couldn't for love or money get my calls to run() to use sudo on the >> server. I played with run_method, use_sudo, try_sudo etc. >> >> So, >> 1) What variable(s) should I be setting to enable or disable sudo >> prefixing ? run_method ? use_sudo ? something else ? >> 2) what is the recommended method to use for scripting commands that >> obeys the above setting ? sudo ? run? try_sudo ? something else ? >> >> I have 2 years Ruby experience and thought I knew Capistrano, but this >> stumped me. It was a deadline crunch and my brains were mostly fried >> though. >> >> Thanks for any suggestions, >> >> Gary >> > > > > --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
