[Backgroundrb-devel] Upgrading from older version - how?

Jonathan Wallace jonathan.wallace at gmail.com
Fri Mar 28 14:44:06 EDT 2008


On Fri, Mar 28, 2008 at 2:13 PM, Emil Marceta <emarceta at gmail.com> wrote:
[snip]
>  5) ./script/background start | stop are unreliable. Stop throws if the
>  pid file is not found. Invoking start multiple times start multiple
>  processes - not sure what that means. Invoking stop afterwards stops
>  only the one process obviously.

I'm unable to reproduce the your issue of multiple processes when
invoking start multiple times.  Did you delete your
script/backgroundrb file and run rake backgroundrb:setup?

username at host ~/current_app_name $ ps aux | grep ruby &&
./script/backgroundrb start && ps aux | grep ruby
username  30073  0.0  2.0  48452 35288 ?        Sl   17:39   0:02
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3000 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3000.pid -l
/var/www/rails/app_name/current/log/mongrel.3000.log
username  30076  0.0  2.0  47808 34952 ?        Sl   17:39   0:02
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3001 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3001.pid -l
/var/www/rails/app_name/current/log/mongrel.3001.log
username  30079  0.0  2.1  51284 38292 ?        Sl   17:39   0:03
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3002 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3002.pid -l
/var/www/rails/app_name/current/log/mongrel.3002.log
username  30082  0.0  1.9  46684 33820 ?        Sl   17:40   0:02
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3003 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3003.pid -l
/var/www/rails/app_name/current/log/mongrel.3003.log
username  30402  0.0  1.7  43000 30396 ?        S    18:28   0:00 ruby
/var/www/rails/app_name/current/script/backgroundrb start
username  30403  0.0  1.7  42864 29860 ?        S    18:28   0:00 ruby
log_worker
username  30409  0.1  1.9  44972 33576 ?        S    18:28   0:01 ruby
queue_processing_worker
username  30484  0.0  0.0   1700   504 pts/0    R+   18:37   0:00 grep
--colour=auto ruby
username  30073  0.0  2.0  48452 35288 ?        Sl   17:39   0:02
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3000 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3000.pid -l
/var/www/rails/app_name/current/log/mongrel.3000.log
username  30076  0.0  2.0  47808 34952 ?        Sl   17:39   0:02
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3001 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3001.pid -l
/var/www/rails/app_name/current/log/mongrel.3001.log
username  30079  0.0  2.1  51284 38292 ?        Sl   17:39   0:03
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3002 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3002.pid -l
/var/www/rails/app_name/current/log/mongrel.3002.log
username  30082  0.0  1.9  46684 33820 ?        Sl   17:40   0:02
/usr/bin/ruby18 /usr/bin/mongrel_rails start -d -e production -a
10.252.63.80 -c /var/www/rails/app_name/current -p 3003 -P
/var/www/rails/app_
name/current/tmp/pids/mongrel.3003.pid -l
/var/www/rails/app_name/current/log/mongrel.3003.log
username  30402  0.0  1.7  43008 30404 ?        S    18:28   0:00 ruby
/var/www/rails/app_name/current/script/backgroundrb start
username  30403  0.0  1.7  42864 29868 ?        S    18:28   0:00 ruby
log_worker
username  30409  0.1  1.9  44972 33576 ?        S    18:28   0:01 ruby
queue_processing_worker
username  30488  0.0  1.6  41724 29224 pts/0    R    18:37   0:00 ruby
log_worker
username  30490  0.0  0.0   1700   504 pts/0    R+   18:37   0:00 grep
--colour=auto ruby


I use capistrano and have added the following tasks to my
config/deploy.rb for handling the thrown error where a pid file
doesn't exist.

 task :restart do
    run "mongrel_rails cluster::restart -C #{mongrel_conf}"
    restart_backgroundrb
  end

  task :restart_backgroundrb do
    begin stop_backgroundrb; rescue; end #this catches the bdrb error
where a PID file doesn't exist
    start_backgroundrb
  end

  task :stop_backgroundrb do
    run "#{deploy_to}/current/script/backgroundrb stop"
  end

  task :start_backgroundrb do
    run "#{deploy_to}/current/script/backgroundrb start"
  end

Good luck!
  Jonathan


More information about the Backgroundrb-devel mailing list