[Backgroundrb-devel] Start script not working when run via Rake

Olly Lylo list at lylo.co.uk
Fri Jan 4 05:07:34 EST 2008


>
> Okay, I have imported changes in stop part of script. Again, are you
> able to start backgroundrb from command prompt? Is it that, just cap
> tasks fails?



Works fine from the command prompt -- it just doesn't start when run from
the Cap task.

Try printing value of RAILS_HOME and see if its correct.
>

RAILS_HOME is correct.  I've added ':log: foreground' to my YML file and put
some logging into the backgroundrb script as detailed below, to try and
figure this out:

when 'start'
  if fork
    puts 'Exiting'
    exit
  else

    path = "#{RAILS_HOME}/log/backgroundrb.pid"
    puts "Path = #{path}"
    config_file = YAML.load(ERB.new(IO.read
("#{RAILS_HOME}/config/backgroundrb.yml")).result)
    op = File.open(path, "w")
    op.write(Process.pid().to_s)
    op.close
    if config_file[:backgroundrb][:log].nil? or
config_file[:backgroundrb][:log] != 'foreground'
      log_file = File.open(SERVER_LOGGER,"w+")
      [STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)}
    end

    puts "Creating proxing"
    BackgrounDRb::MasterProxy.new()
  end

puts "Done"


The output is:

Path = /var/www/apps/my_app/releases/20080103141158/log/backgroundrb.pid
Creating proxy
Exiting


This seems fine except the 'puts "Done"' statement at the end of the block
isn't being callled.   Does this give you any idea about what might be
happening?


Cheers, Olly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080104/59bf28b2/attachment.html 


More information about the Backgroundrb-devel mailing list