Sha256: 41f74a4a3298cb02a623ebbf26f334b8c30727555ced6f2895f043fe5b0fcbc8

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

# To pickup non-gem oats for local debugging

if File.directory? agent_dir = File.expand_path('../../../oats_agent/lib', __FILE__)
  $:.unshift  agent_dir 
  gem 'log4r'
  require 'oats_agent' # bundler fails when it can't find the gem if not in here 
end

require 'oats_agent/commandline_options'
require 'log4r'

Log4r::Logger.root.level = Log4r::DEBUG
Log4r::StdoutOutputter.new('console', :level=>1,
  :formatter=>Log4r::PatternFormatter.new(:depth=>50,
    :pattern => "%-5l %d %M", :date_pattern=>"%y-%m-%d %H:%M:%S"))
$log = Log4r::Logger.new('R')
$log.add('console')
options = OatsAgent::CommandlineOptions.options(ARGV.dup)
if options["agent_host"].nil? or options["agent_host"] == ENV['HOSTNAME']
  OatsAgent.spawn(options)
else
  params = ARGV.dup
  if RUBY_PLATFORM =~ /(mswin|mingw)/
    cmd = "psexec.exe -d -i -n 10 -w " + ENV['HOME'] + '/results_archive' +
      ' -u qa -p ' + 'passwd' + ' \\\\' + options["agent_host"] +
      ' ruby oats_agent ' + params.join(' ')
  else
    #  params.delete('-a')
    #  params.delete(options["agent_host"])
    #  options['agent_host'] = ENV['HOSTNAME']
    cmd = "ssh " + options["agent_host"] + ' oats_agent ' + params.join(' ')
  end
  out = `#{cmd}`
  $log.info out unless out == ''
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oats_agent-0.0.2 bin/oats_agent