Sha256: eb6a3b3ebd99f1ab418e9c4cdad89f6ec585b92c6a4d36602d252cc1b04448a9

Contents?: true

Size: 733 Bytes

Versions: 4

Compression:

Stored size: 733 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'

env, cmd = 'development', nil
ARGV.each do |arg|
  if arg =~ /RAILS_ENV\s*=\s*(\w+)/
    env = $1
  else
    cmd = arg
  end
end

unless %w{index start stop restart}.include?(cmd)
  puts "Usage: script/sphinx RAILS_ENV=production [index|start|stop|restart]"
  exit -1
end

dir = File.expand_path('.')

daemon_options = {
  :multiple   => false,
  :dir_mode   => :normal,
  :dir        => File.join(dir, 'log'),
  :backtrace  => true
}

ARGV.clear
ARGV << cmd

Daemons.run_proc('worker', daemon_options) do
  ARGV.clear

  Dir.chdir dir
  ENV['RAILS_ENV'] = RAILS_ENV = env
  require File.join('config', 'environment')
  require 'delayed_job'

  Delayed::Worker.new.start
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zena-0.16.4 bricks/worker/misc/worker
zena-0.16.3 bricks/worker/misc/worker
zena-0.16.2 bricks/worker/misc/worker
zena-0.16.1 bricks/worker/misc/worker