diff --git a/service.go b/service.go index 1ffca78a..cf41748a 100644 --- a/service.go +++ b/service.go @@ -141,7 +141,7 @@ type Config struct { // - RunWait func() (wait for SIGNAL) - Do not install signal but wait for this function to return. // - ReloadSignal string () [USR1, ...] - Signal to send on reaload. // - PIDFile string () [/run/prog.pid] - Location of the PID file. - // - LogOutput bool (false) - Redirect StdErr & StdOut to files. + // - LogOutput bool (false) - Redirect StdErr & StandardOutPath to files. // - Restart string (always) - How shall service be restarted. // - SuccessExitStatus string () - The list of exit status that shall be considered as successful, // in addition to the default ones. diff --git a/service_darwin.go b/service_darwin.go index 9626bd33..8f1b7b32 100644 --- a/service_darwin.go +++ b/service_darwin.go @@ -160,6 +160,9 @@ func (s *darwinLaunchdService) Install() error { KeepAlive, RunAtLoad bool SessionCreate bool + StandardOut bool + StandardError bool + }{ Config: s.Config, Path: path, @@ -184,7 +187,7 @@ func (s *darwinLaunchdService) Uninstall() error { func (s *darwinLaunchdService) Status() (Status, error) { exitCode, out, err := runWithOutput("launchctl", "list", s.Name) if exitCode == 0 && err != nil { - if !strings.Contains(err.Error(), "failed with stderr") { + if !strings.Contains(err.Error(), "failed with StandardError") { return StatusUnknown, err } } @@ -261,22 +264,36 @@ var launchdConfig = ` - -Label{{html .Name}} -ProgramArguments - - {{html .Path}} -{{range .Config.Arguments}} - {{html .}} -{{end}} - -{{if .UserName}}UserName{{html .UserName}}{{end}} -{{if .ChRoot}}RootDirectory{{html .ChRoot}}{{end}} -{{if .WorkingDirectory}}WorkingDirectory{{html .WorkingDirectory}}{{end}} -SessionCreate<{{bool .SessionCreate}}/> -KeepAlive<{{bool .KeepAlive}}/> -RunAtLoad<{{bool .RunAtLoad}}/> -Disabled - + + Label + {{html .Name}} + ProgramArguments + + {{html .Path}} + {{range .Config.Arguments}} + {{html .}} + {{end}} + + {{if .UserName}}UserName + {{html .UserName}}{{end}} + {{if .ChRoot}}RootDirectory + {{html .ChRoot}}{{end}} + {{if .WorkingDirectory}}WorkingDirectory + {{html .WorkingDirectory}}{{end}} + SessionCreate + <{{bool .SessionCreate}}/> + KeepAlive + <{{bool .KeepAlive}}/> + RunAtLoad + <{{bool .RunAtLoad}}/> + Disabled + + + StandardOutPath + /usr/local/var/log/{{html .Name}}.out.log + StandardErrorPath + /usr/local/var/log/{{html .Name}}.err.log + + `