Hi Philip ~<br><br>I am having this issue too and have been meaning to post. I am using the init script on Gentoo, and it works perfectly if I am in the machine but when running from capistrano it will report a successful start/stop but the process is nowhere to be found. I have to login to the machine and start it manually. I am running on the latest version so I don't think it is a backgroundrb version issue.
<br><br>~ Ben<br><br><div><span class="gmail_quote">On 3/15/07, <b class="gmail_sendername">Philip Lipu Tsai</b> <<a href="mailto:tsailipu@gmail.com">tsailipu@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Erza,<br><br>I am on Centos and bash, Rails 1.2.2, Ruby 1.8.4, BackgrounDrb old version (the 0.1.x version right before 0.2... Is the depend() section peculiar only to Gentoo? If not, anything one needs to do for this?<br>
<br>I wrote a script just similar to this (w/o paying attention to the depend() section) and have capistrano before_restart task invoke the "/etc/init.d/backgroundrbd restart" (which is just stop and then start). However, this problem of backgroundrb's exiting after cap task's successful completion occurs (yes, no hanging in cap's process, but backgroundrb quits even though it is started in -d mode; the pid log file is there, but the process is no longer). Prepending with "nohup" in start seems to work, but I thought by using
init.d style, one needn't worry about the nohup problem, either. Any insight? (Or is this a 0.1.x problem?)<br><br>Thanks,<br><span class="sg">Philip<br><br></span><div><span class="q"><span class="gmail_quote">On 3/12/07,
<b class="gmail_sendername">Ezra Zygmuntowicz
</b> <<a href="mailto:ezmobius@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ezmobius@gmail.com</a>> wrote:</span></span><div><span class="e" id="q_11157cf054c800a9_4"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br> Yeah there are some weird interactions between capistrano and some
<br>daemons, the old version of backgroundrb exibits this behavior. That<br>way I get around it is by creating an init.d script, then letting<br>capuse that to restart bdrb. Works like a charm. Here is an init.d<br>script for Gentoo systems, it should be easy to adapt to any other
<br>unixy system.:<br><br>#!/sbin/runscript<br># Copyright 1999-2004 Gentoo Foundation<br># Distributed under the terms of the GNU General Public License v2<br># $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx-r1,v
<br>1.1 2006/07/04 16:58:38 voxus Exp $<br><br><br>depend() {<br> need net<br> use dns<br> after gfs<br>}<br>start() {<br> ebegin "Starting bdrb2"<br> RAILS_ENV=demo /data/toolbox/current/script/backgroundrb/
<br>start -d<br> eend $? "Failed to start bdrb2"<br>}<br><br>stop() {<br> ebegin "Stopping bdrb2"<br> kill -9 `cat /data/toolbox/current/log/<br>backgroundrb.pid` 2>/dev/null; true
<br> eend $? "Failed to stop bdrb2"<br>}<br><br><br><br>Cheers-<br>-Ezra<br><br><br>On Mar 12, 2007, at 10:47 AM, Ben Reubenstein wrote:<br><br>> Hello ~<br>><br>> I am using the Capistrano recipe outlined in this post to restart
<br>> my backgroundrb server:<br>><br>> <a href="http://rubyforge.org/pipermail/backgroundrb-devel/2007-February/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://rubyforge.org/pipermail/backgroundrb-devel/2007-February/
</a><br>> 000718.html<br>><br>
> My Version:<br>> ~~~~~~~~~~~~<br>> task :before_restart, :roles => :app do<br>> restart_backgroundrb<br>> end<br>><br>> task :start_backgroundrb, :roles => :app do<br>> sudo "nohup /var/www/rails/#{application}/current/script/
<br>> backgroundrb/start "<br>> end<br>><br>> task :stop_backgroundrb, :roles => :app do<br>> sudo "kill -9 `cat /var/www/rails/#{application}/current/log/<br>> backgroundrb.pid` 2>/dev/null; true"
<br>> end<br>><br>> task :restart_backgroundrb, :roles => :app do<br>> stop_backgroundrb<br>> start_backgroundrb<br>> end<br>> ~~~~~~~~~~~~<br>><br>> The backgroundrb server is stopped and started but hangs at the
<br>> start_backgroundrb task. Capistrano shows:<br>><br>> * executing task start_backgroundrb<br>> * executing "sudo nohup /var/www/rails/*************/current/<br>> script/backgroundrb/start"
<br>> servers: ["host"]<br>> [host] executing command<br>> ** [out :: host] nohup: ignoring input and appending output to<br>> `nohup.out'<br>><br>> It will hang there and not restart the main web app process. I
<br>> updated my gems to see if this was a version issue, but am<br>> experiencing the same problem. I also tried running this<br>> task :after_restart, the web app is successfully restarted, but it<br>> still hangs.
<br>><br>> Thanks in advance for any ideas on how to fix this.<br>><br>> ~ Ben<br>><br>> --<br>> Ben Reubenstein<br>> 303-947-0446<br>> <a href="http://www.benr75.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.benr75.com</a><br>
> _______________________________________________<br>> Backgroundrb-devel mailing list<br>> <a href="mailto:Backgroundrb-devel@rubyforge.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Backgroundrb-devel@rubyforge.org</a><br>> <a href="http://rubyforge.org/mailman/listinfo/backgroundrb-devel" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://rubyforge.org/mailman/listinfo/backgroundrb-devel</a><br><br>-- Ezra Zygmuntowicz<br>-- Lead Rails Evangelist<br>-- <a href="mailto:ez@engineyard.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ez@engineyard.com</a><br>-- Engine Yard, Serious Rails Hosting<br>
-- (866) 518-YARD (9273)<br><br><br>_______________________________________________<br>Backgroundrb-devel mailing list<br><a href="mailto:Backgroundrb-devel@rubyforge.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Backgroundrb-devel@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/backgroundrb-devel" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://rubyforge.org/mailman/listinfo/backgroundrb-devel</a><br></blockquote></span></div></div><br>
<br>_______________________________________________<br>Backgroundrb-devel mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Backgroundrb-devel@rubyforge.org">Backgroundrb-devel@rubyforge.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://rubyforge.org/mailman/listinfo/backgroundrb-devel" target="_blank">http://rubyforge.org/mailman/listinfo/backgroundrb-devel</a><br></blockquote>
</div><br><br clear="all"><br>-- <br>Ben Reubenstein<br>303-947-0446<br><a href="http://www.benr75.com">http://www.benr75.com</a>