diff --git a/cmd/runitcmd/status.go b/cmd/runitcmd/status.go index f19fd67..264dc83 100644 --- a/cmd/runitcmd/status.go +++ b/cmd/runitcmd/status.go @@ -38,5 +38,19 @@ func (app *Application) Status(c *cli.Context) { fmt.Printf("enabled %v\n", st.Enabled) fmt.Printf("activated %v\n", st.Activated) fmt.Printf("\n") + if cfg, err := service.Config(); err == nil { + l := cfg.Logging + if l != nil { + fmt.Printf("logging:\n") + fmt.Printf("directory %s\n", l.Directory) + fmt.Printf("max size %d bytes\n", l.Size) + fmt.Printf("number %d\n", l.Num) + fmt.Printf("timeout %d seconds\n", l.Timeout) + fmt.Printf("minimum %d\n", l.Min) + fmt.Printf("\n") + } + } else { + fmt.Printf("logging configuration unavailable\n") + } } } diff --git a/runit/config.go b/runit/config.go index 731c59c..530bfe5 100644 --- a/runit/config.go +++ b/runit/config.go @@ -3,6 +3,7 @@ package runit import ( "io/ioutil" "os" + "path/filepath" "gopkg.in/yaml.v2" ) @@ -48,3 +49,13 @@ func (c *ServiceConfig) SaveFile(path string) error { err = os.Rename(tmppath, path) return err } + +func (s *Service) Config() (*ServiceConfig, error) { + cfgfile := filepath.Join(s.ServiceDir, "service.yaml") + c := &ServiceConfig{} + err := c.LoadFile(cfgfile) + if err != nil { + return nil, err + } + return c, nil +}