[Mongrel] Mongrel_rails restart and sudo

David Vrensk david at vrensk.com
Fri Jun 16 12:10:15 EDT 2006

On 6/16/06, Tom Brice <tom at onidle.com> wrote:
> Sorry for the newbie question but I'm stumped:
> sudo "cd #{current_path} && sudo mongrel_rails restart"
> That doesn't work.

Not having worked with capistrano (yet!  I will better myself one day!) I
really shouldn't advice you, but here goes:

'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.

But I assume that you have the full power of Ruby in capistrano, so you
could try

sudo "mongrel_rails restart"

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:

cd whatever
mongrel_rails restart
-----------end script.sh----

with a

sudo "/path/to/script.sh"

I haven't tried it, but it should be worth a shot.

Good luck,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060616/054e124f/attachment.htm 

More information about the Mongrel-users mailing list