Sha256: 902d5bb18b2ded337977f5174bf1179401bcf66e294fdd954581309b393aa2ee

Contents?: true

Size: 1.17 KB

Versions: 26

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/ruby

#This scripts start an appserver, executes a CGI-request for every FCGI-request and terminates when FCGI terminates.
#Good for programming appserver-supported projects that doesnt need threadding without running an appserver all the time.

error_log_file = "/tmp/hayabusa_fcgi.log"

begin
  File.unlink(error_log_file) if File.exists?(error_log_file)
rescue Errno::ENOENT
  #ignore.
end

begin
  require "rubygems"
  require "fcgi"
  require "fileutils"
  
  #Try to load development-version to enable debugging without doing constant gem-installations.
  begin
    require "#{File.realpath(File.dirname(__FILE__))}/../../knjrbfw/lib/knjrbfw.rb"
  rescue LoadError
    require "knjrbfw"
  end
  
  #Load 'Hayabusa' and start the FCGI-loop to begin handeling requests.
  require "#{File.dirname(Knj::Os.realpath(__FILE__))}/../lib/hayabusa.rb"
  fcgi = Hayabusa::Fcgi.new
  fcgi.fcgi_loop
rescue Exception => e
  if !e.is_a?(Interrupt)
    #Log error to the log-file if something happened.
    File.open(error_log_file, "w") do |fp|
      fp.puts e.inspect
      fp.puts e.backtrace
      fp.puts ""
    end
  end
  
  #Just raise it normally as if a normal error occurred.
  raise e
end

Version data entries

26 entries across 14 versions & 1 rubygems

Version Path
hayabusa-0.0.30 bin/hayabusa_fcgi.rb
hayabusa-0.0.29 bin/hayabusa_fcgi.rb
hayabusa-0.0.28 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.28 bin/hayabusa_fcgi.rb
hayabusa-0.0.25 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.25 bin/hayabusa_fcgi.rb
hayabusa-0.0.24 bin/hayabusa_fcgi.rb
hayabusa-0.0.24 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.23 bin/hayabusa_fcgi.rb
hayabusa-0.0.23 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.22 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.22 bin/hayabusa_fcgi.rb
hayabusa-0.0.20 bin/hayabusa_fcgi.rb
hayabusa-0.0.20 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.19 bin/hayabusa_fcgi.rb
hayabusa-0.0.19 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.18 bin/hayabusa_fcgi.rb
hayabusa-0.0.18 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.17 bin/hayabusa_fcgi.fcgi
hayabusa-0.0.17 bin/hayabusa_fcgi.rb