On 6/16/06, <b class="gmail_sendername">Tom Brice</b> &lt;<a href="mailto:tom@onidle.com">tom@onidle.com</a>&gt; 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 &quot;cd #{current_path} &amp;&amp; sudo mongrel_rails restart&quot;<br><br>That doesn't work.</blockquote><div><br>Not having worked with capistrano (yet!&nbsp; I will better myself one day!) I really shouldn't advice you, but here goes:
<br><br>'cd', as you note, doesn't &quot;hold&quot; 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 &amp;&amp; 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 &quot;mongrel_rails restart&quot;<br></div><br>making sure to chdir back if you need to.&nbsp; 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 &quot;/path/to/script.sh&quot;<br><br>I haven't tried it, but it should be worth a shot.
<br><br>Good luck,<br><br>/David</div>