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