Sha256: 499445b8f5b93ce72ffec191b9107c8ba1af345ebf336b42ab0ac9682dcc0e62

Contents?: true

Size: 1.77 KB

Versions: 6

Compression:

Stored size: 1.77 KB

Contents

preload do |admiral|
  admiral.logger.warn "admiral preload"
end

before_fork do |admiral, captain|
  admiral.logger.warn "admiral (#{captain.label}) before_fork"
  captain.logger.warn "captain=#{captain.label} before_fork"
end

after_fork do |admiral, captain|
  admiral.logger.warn "admiral (#{captain.label}) after_fork"
  captain.logger.warn "captain=#{captain.label} after_fork"
end

respawn_limit 15, 5

pid "/tmp/navy.pid"

# stderr_path "/tmp/navy-err.log"
# stdout_path "/tmp/navy-out.log"

captain :jack do

  stderr_path "/tmp/navy-jack-err.log"
  stdout_path "/tmp/navy-jack-out.log"

  preload do |captain|
    captain.logger.warn "captain=#{captain.label} preload"
  end

  before_fork do |captain, officer|
    captain.logger.warn "captain=#{captain.label} before_fork"
    officer.logger.warn "(#{captain.label}) officer=#{officer.number} before_fork"
  end

  after_fork do |captain, officer|
    captain.logger.warn "captain=#{captain.label} after_fork"
    officer.logger.warn "(#{captain.label}) officer=#{officer.number} after_fork"
  end

  respawn_limit 15, 5

  officers 2 do |officer|
    trap(:QUIT) { exit }
    trap(:TERM) { exit }
    # raise "HELLO"
    n = 0
    loop do
      Navy.logger.info "#{n} jack called (officer=#{officer.number}) pid: #{officer.officer_pid}"
      # Navy.logger.info "START_CTX: #{START_CTX.inspect}"
      # Navy.logger.info "Navy::Admiral::CAPTAINS: #{Navy::Admiral::CAPTAINS.inspect}"
      # Navy.logger.info "Navy::Admiral::OFFICERS: #{Navy::Captain::OFFICERS.inspect}"
      sleep 1
      n += 1
    end
  end

end

captain :blackbeard do

  pid "/tmp/navy-blackbeard.pid"

  officers 5 do
    trap(:QUIT) { exit }; trap(:TERM) { exit }; loop { sleep 1 }
  end
  # officers 5 do
  #   trap(:QUIT, :TRAP) { exit }

  #   nil while true
  # end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
navy-1.0.5 examples/navy.conf.rb
navy-1.0.4 examples/navy.conf.rb
navy-1.0.3 examples/navy.conf.rb
navy-1.0.2 examples/navy.conf.rb
navy-1.0.1 examples/navy.conf.rb
navy-1.0.0 examples/navy.conf.rb