Sha256: c32d6ee190d336b31f7d76e1698341103c580c092b19ca436675587b448367e6

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby

require "optparse"

require "panopticon"

opt = OptionParser.new
OPTS=Panopticon::Daemon.default_options

opt.on("-f", "--config-file [CONFIGFILE=#{Panopticon::Daemon::DEFAULT_CONFIG_PATH}]",
       "config file") {|v|
  OPTS[:config_file] = v
}

opt.on("-p", "--port [APIPORT=#{Panopticon::Daemon::DEFAULT_API_PORT}]",
       "api port") {|v|
  OPTS[:port] = v.to_i
}

opt.on("-i", "--interface [IFNAME=#{Panopticon::Daemon::DEFAULT_IFNAME}]",
       "interface name to capture") {|v|
  OPTS[:ifname] = v
}

opt.on("-c", "--capture-path [CAPTUREPATH=#{Panopticon::Daemon::DEFAULT_CAPTURE_PATH}]", "path to save capture files") {|v|
  OPTS[:capture_path] = v
}

opt.on('-l', "--log-file [LOG_FILE=#{Panopticon::Daemon::DEFAULT_LOG_FILE}]",
       "log output file (accepts 'STDOUT', 'STDERR')") {|v|
  OPTS[:log_file] = v
}

(class<<self;self;end).module_eval do
  define_method(:usage) do |msg|
    puts opt.to_s
    puts "error: #{msg}" if msg
    exit 1
  end
end

begin
  rest = opt.parse(ARGV)
  if rest.length != 0
    usage nil
  end
rescue
  usage $!.to_s
end

$log = Log.new(:output => OPTS[:log_file])
Panopticon::Daemon.new(OPTS).run

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
panopticon-0.1.1 exe/panopticond
panopticon-0.1.0 exe/panopticond