Sha256: 47c3ce31138b3d8cfa3b2736c41b5f82d3dc7e48117e54d45680535e067d0dc5
Contents?: true
Size: 938 Bytes
Versions: 14
Compression:
Stored size: 938 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/worker RAILS_ENV=production [start|stop|restart]" exit -1 end dir = File.expand_path('.') daemon_options = { :multiple => false, :dir_mode => :normal, :dir => File.join(dir, 'log'), :backtrace => true, # Create a worker.output to redirect STDOUT and STDERR :log_output => 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/worker' begin require 'thinking_sphinx/deltas/delayed_delta' rescue LoadError # Ignore end puts "Starting worker..." Delayed::Worker.new.start end
Version data entries
14 entries across 14 versions & 1 rubygems