lib/bixby-agent/app.rb
def run!
    # load agent from config or cli opts
    agent = load_agent()

    fix_ownership()

    # debug mode, stay in front
    if @config[:debug] then
      Logging::Logger.root.add_appenders("stdout")
      return start_websocket_client()
    end

    # start daemon
    validate_argv()
    daemon_dir = Bixby.path("var")
    ensure_state_dir(daemon_dir)
    close_fds()

    daemon_opts = {
      :dir        => daemon_dir,
      :dir_mode   => :normal,
      :log_output => true,
      :stop_proc  => lambda { logger.info "Agent shutdown on service stop command" }
    }

    Daemons.run_proc("bixby-agent", daemon_opts) do
      Logging.logger.root.clear_appenders
      start_websocket_client()
    end
  end
def run!
    # load agent from config or cli opts
    agent = load_agent()

    fix_ownership()

    # debug mode, stay in front
    if @config[:debug] then
      Logging::Logger.root.add_appenders("stdout")
      return start_websocket_client()
    end

    # start daemon
    validate_argv()
    daemon_dir = Bixby.path("var")
    ensure_state_dir(daemon_dir)
    close_fds()

    daemon_opts = {
      :dir        => daemon_dir,
      :dir_mode   => :normal,
      :log_output => true,
      :stop_proc  => lambda { logger.info "Agent shutdown on service stop command" }
    }

    Daemons.run_proc("bixby-agent", daemon_opts) do
      Logging.logger.root.clear_appenders
      start_websocket_client()
    end
  end
def run! # load agent from config or cli opts agent = load_agent ( ) fix_ownership ( ) # debug mode, stay in front if @config [ :debug ] then Logging :: Logger . root . add_appenders ( "stdout" ) return start_websocket_client ( ) end # start daemon validate_argv ( ) daemon_dir = Bixby . path ( "var" ) ensure_state_dir ( daemon_dir ) close_fds ( ) daemon_opts = { :dir => daemon_dir , :dir_mode => :normal , :log_output => true , :stop_proc => lambda { logger . info "Agent shutdown on service stop command" } } Daemons . run_proc ( "bixby-agent" , daemon_opts ) do Logging . logger . root . clear_appenders start_websocket_client ( ) end end
Run the agent app!

 This is the main method. Will boot and configure the agent, connect to the
 server and start the daemon.
Run the agent app!