[Mongrel] Mongrel_rails restart and sudo

Alison Rowland alisonrowland at fastmail.fm
Fri Jun 16 12:13:51 EDT 2006


I don't know what's going on with your restart task failing. You  
should probably fix that before worrying about Capistrano, but in the  
event that you get it working, here's a bit more Cap info.

I just looked at my deploy.rb, and it has a little extra bit of  
structure which may help. Here's my whole restart task, which I  
originally grabbed from somebody's snippets:

desc "Restart the web server"
task :restart, :roles => :app do
   begin
     run "cd #{current_path}"
     sudo "mongrel_cluster_ctl restart"
   rescue RuntimeError => e
     puts e
     puts "Probably not a big deal, so I'll just keep trucking..."
   end
end

Perhaps wrapping it in begin...rescue...end lets Capistrano know to  
execute it all as one thing.

--Alison
http://blog.alisonrowland.com

On Jun 16, 2006, at 11:47 AM, Tom Brice wrote:

> On 6/16/06 10:29 AM, Alison Rowland  wrote:
>
>> two lines, like so:
>>
>> run "cd #{current_path}"
>> sudo "mongrel_rails restart"
>
> Thanks Alison.
>
> I though I tried this but I just rechecked.  Problem is  
> capistrano.  When I
> try this the cd executes but doesn't "hold".  This means that my
> mongrel_rails restart command is executed in my home dir (not my
> RAILS_ROOT).  It doesn't find the PID file so it fails.
>
> Any other ideas?
>
> Tom
>
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users



More information about the Mongrel-users mailing list