Sha256: 21e33a23a4641771220133ce427f024eb1617d71fa87746579e3bb5328193e6f

Contents?: true

Size: 1018 Bytes

Versions: 9

Compression:

Stored size: 1018 Bytes

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::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

9 entries across 9 versions & 1 rubygems

Version Path
naf-2.1.3 bin/naf
naf-2.1.2 bin/naf
naf-2.1.1 bin/naf
naf-2.1.0 bin/naf
naf-2.0.4 bin/naf
naf-2.0.3 bin/naf
naf-2.0.2 bin/naf
naf-2.0.1 bin/naf
naf-2.0.0 bin/naf