Sha256: 11ab93c893419b5f09663467e6be1215be4f157cf964deb991cdf4bfebddcbc0

Contents?: true

Size: 676 Bytes

Versions: 1

Compression:

Stored size: 676 Bytes

Contents

#!/usr/bin/env ruby
if ARGV.length < 2
  puts "usage: #{File.basename __FILE__} (run|start|stop) <path_to_config_file>"
  exit 1
end

require 'server_status'
require 'daemons'

set_config ARGV[1]

conf_name = File.expand_path ARGV[1]
pid_name = "#{File.basename __FILE__}.pid"
pid_path = pid_name

case ARGV[0]
when 'run'
  ServerStatusApp.run!
when 'start'
  Daemons.daemonize app_name: "#{File.basename __FILE__}"
  ServerStatusApp.run!
when 'stop'
  pid = 0
  File.open("#{pid_path}", 'r') do |file|
    pid = file.read.to_i
  end
  if pid != 0
    Process.kill('SIGINT', pid)
  end
else
  puts "usage: #{File.basename __FILE__} (run|start|stop) <path_to_config_file>"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
server_status-0.1.1 bin/statusd