On 6/16/06, <b class="gmail_sendername">Tom Brice</b> <<a href="mailto:tom@onidle.com">tom@onidle.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sorry for the newbie question but I'm stumped:<br><br>sudo "cd #{current_path} && sudo mongrel_rails restart"<br><br>That doesn't work.</blockquote><div><br>Not having worked with capistrano (yet! I will better myself one day!) I really shouldn't advice you, but here goes:
<br><br>'cd', as you note, doesn't "hold" since it affects the process it runs in, and I assume that capistrano's sudo either splits your command in two, running them in two different, consecutive processes, or just sends it along, in which case the system's sudo doesn't handle && very well.
<br><br>But I assume that you have the full power of Ruby in capistrano, so you could try<br><br>Dir.chdir(current_path)<br>sudo "mongrel_rails restart"<br></div><br>making sure to chdir back if you need to. If that doesn't work, how about putting your commands in a shell script and running that:
<br><br>-----------script.sh--------<br>#!/bin/sh<br>cd whatever<br>mongrel_rails restart<br>-----------end script.sh----<br><br>with a<br><br>sudo "/path/to/script.sh"<br><br>I haven't tried it, but it should be worth a shot.
<br><br>Good luck,<br><br>/David</div>