(serviceName string)
| 44 | } |
| 45 | |
| 46 | func (s *Systemd) IsExist(serviceName string) (bool, error) { |
| 47 | out, err := run(s.Client, s.toolCmd, "is-enabled", serviceName) |
| 48 | if err != nil && out != "enabled\n" { |
| 49 | if strings.Contains(out, "disabled") { |
| 50 | return true, err |
| 51 | } |
| 52 | if NewSnap().IsExist(serviceName) { |
| 53 | return true, nil |
| 54 | } |
| 55 | return false, err |
| 56 | } |
| 57 | return true, err |
| 58 | } |
| 59 | |
| 60 | func (s *Systemd) Status(serviceName string) (string, error) { |
| 61 | return run(s.Client, s.toolCmd, "status", serviceName) |