MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / IsExist

Method IsExist

agent/utils/controller/manager/systemd.go:41–54  ·  view source on GitHub ↗
(serviceName string)

Source from the content-addressed store, hash-verified

39}
40
41func (s *Systemd) IsExist(serviceName string) (bool, error) {
42 out, err := run(s.toolCmd, "is-enabled", serviceName)
43 switch strings.TrimSpace(out) {
44 case "enabled", "enabled-runtime", "disabled", "static", "indirect", "generated", "transient", "alias", "linked", "linked-runtime", "masked", "masked-runtime":
45 return true, err
46 }
47 if err != nil && out != "enabled\n" {
48 if NewSnap().IsExist(serviceName) {
49 return true, nil
50 }
51 return false, err
52 }
53 return true, err
54}
55
56func (s *Systemd) Status(serviceName string) (string, error) {
57 return run(s.toolCmd, "status", serviceName)

Callers

nothing calls this directly

Calls 3

runFunction · 0.70
NewSnapFunction · 0.70
IsExistMethod · 0.65

Tested by

no test coverage detected