Sha256: d00e76012fc9dbe6254c6c20f40343feae79e2c7751e04bfa7423ebdeb82f959

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env ruby

if ARGV.size == 0
  puts '
Usage: controller ( boot | quit )
       controller ( start | status | stop | restart | log ) [worker]
       controller [--help]

Example:
  % controller boot    # start bluepilld and jobs
  % controller status  # check on status of jobs
  % controller log dor_accessionWF_descriptive-metadata # view log for worker
  % controller stop    # stop jobs
  % controller quit    # stop bluepilld

Environment:
  BLUEPILL_BASEDIR - where bluepill stores its state (default: run/bluepill)
  BLUEPILL_LOGFILE - output log (default: log/bluepill.log)
  ROBOT_ENVIRONMENT - (default: development)
'
  exit -1
end

ENV['ROBOT_ENVIRONMENT'] ||= 'development'
ENV['BLUEPILL_BASE_DIR'] ||= File.expand_path('run/bluepill')
ENV['BLUEPILL_LOGFILE']  ||= File.expand_path('log/bluepill.log')

unless File.directory?('config') &&
       File.directory?(File.dirname(ENV['BLUEPILL_BASE_DIR'])) &&
       File.directory?(File.dirname(ENV['BLUEPILL_LOGFILE']))
  raise "Run from root directory"
end

cmd = 'bluepill'
cmd << ' --no-privileged'
cmd << " --base-dir #{ENV['BLUEPILL_BASE_DIR']}"
cmd << " --logfile #{ENV['BLUEPILL_LOGFILE']}"

if ARGV[0] == 'boot'
  fn = 'config/bluepill.rb' # allow override
  unless File.file?(fn)
    require 'robot-controller'
    fn = RobotController.bluepill_config
  end
  if File.file?(fn)
    puts "Loading #{fn}"
    exec "#{cmd} load #{fn}"
    # NOTREACHED
  end
  puts "ERROR: Cannot find bluepill configuration file for #{ENV['ROBOT_ENVIRONMENT']}"
  exit -1
else
  exec "#{cmd} #{ARGV.join(' ')}"
  # NOTREACHED
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
robot-controller-1.0.2 bin/controller
robot-controller-1.0.0 bin/controller
robot-controller-0.3.7 bin/controller
robot-controller-0.3.6 bin/controller
robot-controller-0.3.5 bin/controller