Sha256: 49a35b0f702bc0e680746d4c4d24407f3d70cc08f5a4f01f79a169dc0dc428e8

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

#!/usr/bin/env ruby
# This command will automatically be run when you run "bundle exec naf" from the root of your application.

action, option = ARGV
if action == 'runner'
  if option == 'up'
    puts "Bringing up the runner(s)..."
    `screen -d -m bash -c 'source /root/.bash_profile && cd /root/current && a=\`uuidgen\` && script/rails runner ::Process::Naf::Runner.run --invocation-uuid $a 2>&1 |
      script/rails runner ::Process::Naf::Logger::RunnerLog.run --invocation-uuid $a'`

  elsif option == 'status'
    num_runners = Integer(`ps -ef | grep Process::Naf::Runner.run | grep -v grep | grep -v uuidgen | wc -l`.strip)
    hostname = `hostname`.strip
    if num_runners == 0
      puts "down: #{hostname}"
    elsif num_runners == 1
      puts "up: #{hostname}"
    else
      puts "up/w: #{hostname} (#{num_runners})"
    end

  elsif option == 'down'
    puts 'Bringing down runner(s)...'
    `kill $(ps -ef | grep Process::Naf::Runner.run | grep -v grep | grep -v uuidgen | awk '{ print $2 }') | cat`
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
naf-2.1.10 bin/naf
naf-2.1.9 bin/naf
naf-2.1.8 bin/naf
naf-2.1.6 bin/naf
naf-2.1.5 bin/naf
naf-2.1.4 bin/naf