As before, with the :as option:
run "cd #{latest_release}; #{sudo :as => "bob"} bin/merb #{merb_options}"
- Jamis
On 4/28/09 6:52 PM, Mr_Tibs wrote:
> Thanks Jamis. I'm only using "sudo" because I want that command to be
> run by a different user. How would I specify the user's name in the
> example that you gave?
>
> Tiberiu
>
> On Apr 28, 5:33 pm, Jamis Buck<[email protected]> wrote:
>> 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
>>> viawww.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
-~----------~----~----~----~------~----~------~--~---