Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e6dc1697b5
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 48 lines (38 sloc) 1.366 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#!/usr/bin/env ruby

RAILS_HOME = File.expand_path(File.join(File.dirname(__FILE__),".."))
BDRB_HOME = File.join(RAILS_HOME,"vendor","plugins","backgroundrb")
WORKER_ROOT = File.join(RAILS_HOME,"lib","workers")
WORKER_LOAD_ENV = File.join(RAILS_HOME,"script","load_worker_env")

["server","server/lib","lib","lib/backgroundrb"].each { |x| $LOAD_PATH.unshift(BDRB_HOME + "/#{x}")}
$LOAD_PATH.unshift(WORKER_ROOT)

require 'rubygems'
require RAILS_HOME + "/config/boot"
require "active_support"
require 'bdrb_config'

BDRB_CONFIG = BackgrounDRb::Config.read_config("#{RAILS_HOME}/config/backgroundrb.yml")
PID_FILE = "#{RAILS_HOME}/tmp/pids/backgroundrb_#{BDRB_CONFIG[:backgroundrb][:port]}.pid"
SERVER_LOGGER = "#{RAILS_HOME}/log/backgroundrb_debug_#{BDRB_CONFIG[:backgroundrb][:port]}.log"

require 'bdrb_start_stop'
daemon = BackgrounDRb::StartStop.new

case ARGV[0]
when 'start'; daemon.start
when 'stop'; daemon.stop
when 'restart'; daemon.stop;daemon.start
when 'status'
  if daemon.running?
    puts "BackgrounDRb Running"
    exit
  else
    puts "BackgrounDRb Not Running"
    exit!(daemon.status)
  end
else
  require "logger"
  require "packet"
  require "optparse"

  BackgrounDRb::Config.parse_cmd_options ARGV

  require RAILS_HOME + "/config/environment"
  require "bdrb_job_queue"
  require "backgroundrb_server"
  BackgrounDRb::MasterProxy.new()
end

Something went wrong with that request. Please try again.