7 [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
8 [ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT],
9 [ '--pidfile', '-p', GetoptLong::REQUIRED_ARGUMENT]
12 if MCollective::Util.windows?
13 configfile = File.join(MCollective::Util.windows_prefix, "etc", "server.cfg")
15 configfile = "/etc/mcollective/server.cfg"
19 opts.each do |opt, arg|
22 puts "Usage: mcollectived.rb [--config /path/to/config] [--pidfile /path/to/pid]"
31 config = MCollective::Config.instance
33 config.loadconfig(configfile) unless config.configured
35 MCollective::Log.info("The Marionette Collective #{MCollective::VERSION} started logging at #{config.loglevel} level")
38 MCollective::Log.debug("Starting in the background (#{config.daemonize})")
40 if MCollective::Util.windows?
41 require 'mcollective/windows_daemon'
43 MCollective::WindowsDaemon.daemonize_runner
45 require 'mcollective/unix_daemon'
47 MCollective::UnixDaemon.daemonize_runner(pid)
50 MCollective::Log.debug("Starting in the foreground")
51 runner = MCollective::Runner.new(configfile)