[Backgroundrb-devel] Fails to start via Capistrano?

E. Johnson root at erikj.info
Sat Feb 7 11:49:55 EST 2009


It looks like the restart of backgroundrb failed to start backgroundrb
because restart's stop-backgroundrb failed (nothing running, nothing
to stop), and quit the task.

If that's the case, perhaps a start_backgroundrb task is in order? I'm
controlling backgroundrb via god, and calling them from capistrano w/
the following task set:

$ cap -T |grep backgroundrb
cap restart_backgroundrb       # restart backgroundrb servers
cap start_backgroundrb         # start backgroundrb servers
cap stop_backgroundrb          # stop backgroundrb servers

# Backgroundrb Server TASKS
%w(start stop restart).each do |cmd|
  desc "#{cmd} backgroundrb servers"
  task "#{cmd}_backgroundrb".to_sym, :roles => :app do
    run "sudo #{god} #{cmd} backgroundrb"
  end
end

hope that helps,
Erik


On 2/7/09, andrew at workingtechnology.co.uk
<andrew at workingtechnology.co.uk> wrote:
> 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.
>
>  _______________________________________________
>  Backgroundrb-devel mailing list
>  Backgroundrb-devel at rubyforge.org
>  http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>


More information about the Backgroundrb-devel mailing list