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

hemant gethemant at gmail.com
Thu Jan 3 16:55:33 EST 2008


On Jan 3, 2008 8:33 PM, Olly Lylo <list at lylo.co.uk> wrote:
> Hi there
>
> I'm using the latest release (r300) and 'script/backgroundrb start' works
> perfectly when executed on the server, but when put inside a Rake task, it
> doesn't launch the worker processes.
>
> The Rake task is as follows:
>
> task :start_backgroundrb do
>   run "cd #{current_path} && ./script/backgroundrb start"
> end
>
> When I run this task, the following files are created in the log directory:
>
> backgroundrb.pid
> backgroundrb_debug.log
> backgroundrb_server.log
>
>
> Observations: The process ID found in backgroundrb.pid doesn't exist,
> backgroundrb_server.log is zero bytes long and backgroundrb_debug.log
> contains the following:
>
> # Logfile created on Thu Jan 03 14:43:24 +0000 2008 by /
>
>
> It looks like the process is being started by Rake, but terminates before
> the worker processes are started.   Could anyone shed any light on why this
> might be happening and how I can resolve the issue?
>
> I have also noticed that calling './script/backgroundrb stop' when
> BackgroundRB isn't running throws an exception, which causes problems when
> executing 'backgroundrb stop' in a rake task.  As a workaround I have
> modified by 'backgroundrb' script as follows:
>
> when 'stop'
>   path = "#{RAILS_HOME}/log/backgroundrb.pid"
>   pid = nil
>   begin
>     File.open(path, "r") { |pid_handle| pid =
> pid_handle.gets.strip.chomp.to_i }
>     pgid =  Process.getpgid(pid)
>     Process.kill('TERM', pid)
>     Process.kill('-TERM', pgid)
>     Process.kill('KILL', pid)
>   rescue
>     puts $!
>   ensure
>     puts "Deleting pid file"
>     File.delete(path) if File.exists?(path)
>   end
>

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?

Try printing value of RAILS_HOME and see if its correct.

-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org


More information about the Backgroundrb-devel mailing list