diff --git a/bin/ildusd b/bin/ildusd index 70aa14d..13fdb48 100644 --- a/bin/ildusd +++ b/bin/ildusd @@ -48,7 +48,7 @@ def print_version end # Argument parsing. -cfg_file = nil +cfg_file = "ildusd.conf" opts = GetoptLong.new( [ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT ], [ '--help', '-h', GetoptLong::NO_ARGUMENT ], @@ -68,7 +68,10 @@ rescue GetoptLong::InvalidOption, GetoptLong::MissingArgument end # Main. -puts < Ildus comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; for details see @@ -76,10 +79,12 @@ the COPYING file. START -server = Ildus::Server.new(cfg_file) + ['INT', 'TERM', 'QUIT'].each do |sig| + Signal.trap(sig) { server.shutdown } + end -['INT', 'TERM', 'QUIT'].each do |sig| - Signal.trap(sig) { server.shutdown } + server.start +rescue StandardError => e + puts "#{Program}: #{e}" + exit 2 end - -server.start diff --git a/lib/ildus/server.rb b/lib/ildus/server.rb index f5d894d..f754e97 100644 --- a/lib/ildus/server.rb +++ b/lib/ildus/server.rb @@ -60,8 +60,6 @@ module Ildus # Parses the configuration file _filename_ and stores the parsed # contents. def parse_config(filename) - raise ArgumentError unless FileTest.exists? filename - File.open(filename, "r") do |io| # FIXME: merge the YAML with a default config @config = YAML.load(io)