func NewSvcRunner(backend backends.Backend, context *context.Ctx) Runner { r := &SvcRunner{ RunnerCommon: RunnerCommon{ name: backend.Name(), context: context, backend: backend, }, exec: backend.ExecPath(), args: backend.ExecArgs(), serviceName: "graylog-collector-" + backend.Name(), isRunning: false, } return r }
func (dc *DaemonConfig) NewRunner(backend backends.Backend, context *context.Ctx) *Runner { r := &Runner{ Running: false, Context: context, Backend: backend, Name: backend.Name(), Exec: backend.ExecPath(), Args: backend.ExecArgs(), Stderr: filepath.Join(context.UserConfig.LogPath, backend.Name()+"_stderr.log"), Stdout: filepath.Join(context.UserConfig.LogPath, backend.Name()+"_stdout.log"), Daemon: dc, exit: make(chan struct{}), } return r }
func NewExecRunner(backend backends.Backend, context *context.Ctx) Runner { r := &ExecRunner{ RunnerCommon: RunnerCommon{ name: backend.Name(), context: context, backend: backend, }, exec: backend.ExecPath(), args: backend.ExecArgs(), isRunning: false, restartCount: 1, isSupervised: false, signals: make(chan string), stderr: filepath.Join(context.UserConfig.LogPath, backend.Name()+"_stderr.log"), stdout: filepath.Join(context.UserConfig.LogPath, backend.Name()+"_stdout.log"), } r.signalProcessor() return r }
func (dc *DaemonConfig) AddBackend(backend backends.Backend, context *context.Ctx) { var runner Runner switch backend.Driver() { case "exec": runner = runnerRegistry["exec"](backend, context) case "svc": runner = runnerRegistry["svc"](backend, context) default: log.Fatalf("Execution driver %s is not supported on this platform", backend.Driver()) } runner.SetDaemon(dc) dc.Runner[backend.Name()] = runner }
func (dc *DaemonConfig) AddBackendAsRunner(backend backends.Backend, context *context.Ctx) { dc.Runner[backend.Name()] = dc.NewRunner(backend, context) }