MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / IsEnable

Method IsEnable

core/utils/controller/manager/systemd.go:32–44  ·  view source on GitHub ↗
(serviceName string)

Source from the content-addressed store, hash-verified

30}
31
32func (s *Systemd) IsEnable(serviceName string) (bool, error) {
33 out, err := run(s.Client, s.toolCmd, "is-enabled", serviceName)
34 if err != nil && out != "disabled\n" {
35 if serviceName == "sshd" && out == "alias\n" {
36 return s.IsEnable("ssh")
37 }
38 if NewSnap().IsEnable(serviceName) {
39 return true, nil
40 }
41 return false, err
42 }
43 return out == "enabled\n", nil
44}
45
46func (s *Systemd) IsExist(serviceName string) (bool, error) {
47 out, err := run(s.Client, s.toolCmd, "is-enabled", serviceName)

Callers

nothing calls this directly

Calls 3

runFunction · 0.70
NewSnapFunction · 0.70
IsEnableMethod · 0.65

Tested by

no test coverage detected