Sha256: 6d71c81c12714c3e22ee02efd88092ae6456069df927cf29d6f2dd3c0d2390a5

Contents?: true

Size: 739 Bytes

Versions: 3

Compression:

Stored size: 739 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'yaml'
require 'biobot'
require 'daemonize'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: biobot -c <filename>"

  opts.on("-c", "--config FILENAME", "Specify the configuration file") do |c|
    options[:config] = c
  end

  opts.on("-d", "--daemonize", "Daemonize the process") do
    options[:daemon] = true
  end
end.parse!

unless options[:config]
  puts "No configuration file specified; see --help"
  exit
end
raise Errno::ENOENT   unless File.exist?(options[:config])

biobot = Biobot::Base.new(YAML.load_file(options[:config]))
biobot.start
Signal.trap("TERM") do
  puts "Stopping biobot..."
  biobot.stop
end

Daemonize.daemonize   if options[:daemon]
loop do
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
viking-biobot-0.0.1 bin/biobot
viking-biobot-0.0.2 bin/biobot
viking-biobot-0.0.3 bin/biobot