The preferred way of doing sudo is by embedding #{sudo} in your run
command. invoke_command() and sudo() are both otherwise not recommended.
So, to do sudo with multiple commands:
run "cd #{latest_release}; #{sudo} bin/merb #{merb_options}"
- Jamis
On 4/28/09 5:13 PM, Lee Hambley wrote:
> Tiberiu,
>
> You can't to `sudo cd /somewhere` can you post the Capistrano tasks code
> via www.pastie.org <http://www.pastie.org> for us to help diagnose?
>
> - Lee
>
> 2009/4/29 Mr_Tibs <[email protected] <mailto:[email protected]>>
>
>
> Hi,
>
> I'm trying to do a simple thing with Capistrano: run multiple commands
> in one shell session as a different user. For example: "cd #
> {latest_release}; bin/merb #{merb_options}".
>
> This works with run (e.g. run "cd #{latest_release}; bin/merb #
> {merb_options}"), but it doesn't work with sudo and invoke_command. I
> tried:
> - sudo "#{sudo :as => 'mongrel'} cd #{latest_release}; bin/merb #
> {merb_options}"
> - invoke_command "cd #{latest_release}; bin/merb #
> {merb_options}", :via => run_method, :as => "#{mongrel_user}"
>
> And I get errors from the shell: "sudo: cd: command not found , sh:
> bin/merb: No such file or directory".
>
> Note that I cannot user "#{latest_release}/bin/merb#{merb_options}".
>
> Thanks,
> Tiberiu
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---