[Backgroundrb-devel] Capistrano Hanging on Deployment

Ezra Zygmuntowicz ezmobius at gmail.com
Mon Mar 12 14:18:22 EDT 2007


	Yeah there are some weird interactions between capistrano and some  
daemons, the old version of backgroundrb exibits this behavior. That  
way I get around it is by creating an init.d script, then letting  
capuse that to restart bdrb. Works like a charm. Here is an init.d  
script for Gentoo systems, it should be easy to adapt to any other  
unixy system.:

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx-r1,v  
1.1 2006/07/04 16:58:38 voxus Exp $


depend() {
         need net
         use dns
         after gfs
}
start() {
         ebegin "Starting bdrb2"
           RAILS_ENV=demo /data/toolbox/current/script/backgroundrb/ 
start -d
         eend $? "Failed to start bdrb2"
}

stop() {
         ebegin "Stopping bdrb2"
              kill -9 `cat /data/toolbox/current/log/ 
backgroundrb.pid` 2>/dev/null; true
         eend $? "Failed to stop bdrb2"
}



Cheers-
-Ezra


On Mar 12, 2007, at 10:47 AM, Ben Reubenstein wrote:

> Hello ~
>
> I am using the Capistrano recipe outlined in this post to restart  
> my backgroundrb server:
>
> http://rubyforge.org/pipermail/backgroundrb-devel/2007-February/ 
> 000718.html
>
> My Version:
> ~~~~~~~~~~~~
> task :before_restart, :roles => :app do
>    restart_backgroundrb
> end
>
> task :start_backgroundrb, :roles => :app do
>    sudo "nohup /var/www/rails/#{application}/current/script/ 
> backgroundrb/start "
> end
>
> task :stop_backgroundrb, :roles => :app do
>    sudo "kill -9 `cat /var/www/rails/#{application}/current/log/ 
> backgroundrb.pid` 2>/dev/null; true"
> end
>
> task :restart_backgroundrb, :roles => :app do
>    stop_backgroundrb
>    start_backgroundrb
> end
> ~~~~~~~~~~~~
>
> The backgroundrb server is stopped and started but hangs at the  
> start_backgroundrb task.  Capistrano shows:
>
>   * executing task start_backgroundrb
>   * executing "sudo  nohup /var/www/rails/*************/current/ 
> script/backgroundrb/start"
>     servers: ["host"]
>     [host] executing command
>  ** [out :: host] nohup: ignoring input and appending output to  
> `nohup.out'
>
> It will hang there and not restart the main web app process.  I  
> updated my gems to see if this was a version issue, but am  
> experiencing the same problem.  I also tried running this  
> task :after_restart, the web app is successfully restarted, but it  
> still hangs.
>
> Thanks in advance for any ideas on how to fix this.
>
> ~ Ben
>
> -- 
> Ben Reubenstein
> 303-947-0446
> http://www.benr75.com
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel

-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)




More information about the Backgroundrb-devel mailing list