[Backgroundrb-devel] Fails to start via Capistrano?

andrew at workingtechnology.co.uk andrew at workingtechnology.co.uk
Sat Feb 7 03:02:38 EST 2009


Hi,

I have a production environment setup on CentOS 5.2. Latest versions  
of backgroundrb and associated gems.

When I run script/backgroundrb start directly from the command line on  
the server is starts fine.

"RAILS_ENV=production script/backgroundrb start"

However the following capistrano task doesn't seem to work correctly.  
It creates the pid file containing what looks like a valid id but when  
looking for the running process with "ps -aux | grep background"  
nothing is found (whereas a process is listed if started via command  
prompt).

If I start the backgroundrb script manually at the command prompt and  
then run the cap task to restart it doesn't give any errors, it stops  
normally (no errors regarding missing process) and appears to restart  
normally. However on inspection you can see there is no process  
running after starting via cap.

No obvious errors are generated in any logs. Has anyone experienced  
anything similar or have any pointers on where to start looking?

Thanks, Andrew.

==backgroundrb.yml==

:backgroundrb:
   :port: 11006
   :ip: 0.0.0.0
   :environment: production
   :persistent_delay: 10

==deploy.rb==

ssh_options[:paranoid] = false
default_run_options[:pty] = true

set :user, 'deploy'
set :runner, 'deploy'
set :use_sudo, false

role :app, "192.168.10.60"
role :web, "192.168.10.60"
role :db,  "192.168.10.60", :primary => true

...

desc "Restart Backgroundrb"
task :restart_backgroundrb, :roles => [:app] do
   run "cd #{current_path} && RAILS_ENV=production script/backgroundrb  
stop"
   run "cd #{current_path} && RAILS_ENV=production script/backgroundrb  
start"
end

==output==

$ cap restart_backgroundrb
   * executing `restart_backgroundrb'
   * executing "cd /var/webapps/optics/current && RAILS_ENV=production  
script/backgroundrb stop"
     servers: ["192.168.10.60"]
Password:
     [192.168.10.60] executing command
  ** [out :: 192.168.10.60] /var/webapps/optics/releases/ 
20090203095224/vendor/plugins/backgroundrb/lib/backgroundrb/ 
bdrb_start_stop.rb:6:in `getpgid'
  ** [out :: 192.168.10.60] :
  ** [out :: 192.168.10.60] No such process
  ** [out :: 192.168.10.60] (
  ** [out :: 192.168.10.60] Errno::ESRCH
  ** [out :: 192.168.10.60] )
  ** [out :: 192.168.10.60] from /var/webapps/optics/releases/ 
20090203095224/vendor/plugins/backgroundrb/lib/backgroundrb/ 
bdrb_start_stop.rb:6:in `kill_process'
  ** [out :: 192.168.10.60] from /var/webapps/optics/releases/ 
20090203095224/vendor/plugins/backgroundrb/lib/backgroundrb/ 
bdrb_start_stop.rb:56:in `stop'
  ** [out :: 192.168.10.60] from /var/webapps/optics/releases/ 
20090203095224/vendor/plugins/backgroundrb/lib/backgroundrb/ 
bdrb_start_stop.rb:56:in `each'
  ** [out :: 192.168.10.60] from /var/webapps/optics/releases/ 
20090203095224/vendor/plugins/backgroundrb/lib/backgroundrb/ 
bdrb_start_stop.rb:56:in `stop'
  ** [out :: 192.168.10.60] from script/backgroundrb:36
     command finished
failed: "sh -c \"cd /var/webapps/optics/current &&  
RAILS_ENV=production script/backgroundrb stop\"" on 192.168.10.60




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Backgroundrb-devel mailing list