Skip to content

Commit

Permalink
Move the daemons code from bin/rq-mgr to code/rq-mgr.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Sep 19, 2015
1 parent d31633c commit e964083
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
30 changes: 1 addition & 29 deletions bin/rq-mgr
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,4 @@ RQ_DIR=$(cd "$(dirname "$0")/.." && pwd)
exec 3>/dev/null 4>/dev/null

# Here we go
exec /usr/bin/env ruby -C "$RQ_DIR" -I . -e "
require 'vendor/environment'
require 'daemons'
require 'code/queuemgr'
options = {
:app_name => 'queuemgr',
:dir_mode => :normal,
:dir => '$RQ_DIR/config',
:multiple => false,
:mode => :exec,
:backtrace => true,
:monitor => false,
:log_dir => '$RQ_DIR/log',
:log_output => false,
}
Daemons.run_proc('queuemgr', options) do
Dir.chdir('$RQ_DIR')
require 'logger'
\$log = Logger.new('log/queuemgr.log')
\$log.level = Logger::INFO
\$log.progname = \$0
RQ::QueueMgr.new.run!
end
" -- $@
exec /usr/bin/env ruby -C "$RQ_DIR" -I . code/rq-mgr.rb $@
31 changes: 31 additions & 0 deletions code/rq-mgr.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'vendor/environment'
require 'daemons'

require 'code/queuemgr'

options = {
:app_name => 'queuemgr',
:dir_mode => :normal,
:dir => './config',
:multiple => false,
:mode => :exec,
:backtrace => true,
:monitor => false,
:log_dir => './log',
:log_output => false,
}

# Daemons will chdir to / but there are many assumptions
# in code/ that it is running from the RQ basedir.
RQ_DIR = Dir.pwd

Daemons.run_proc('queuemgr', options) do
Dir.chdir RQ_DIR

require 'logger'
$log = Logger.new('log/queuemgr.log')
$log.level = Logger::INFO
$log.progname = $0

RQ::QueueMgr.new.run!
end

0 comments on commit e964083

Please sign in to comment.