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

Method IsEnable

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

Source from the content-addressed store, hash-verified

25}
26
27func (s *Systemd) IsEnable(serviceName string) (bool, error) {
28 out, err := run(s.toolCmd, "is-enabled", serviceName)
29 if out == "alias\n" && serviceName == "sshd.service" {
30 return s.IsEnable("ssh")
31 }
32 if err != nil && out != "disabled\n" {
33 if NewSnap().IsEnable(serviceName) {
34 return true, nil
35 }
36 return false, err
37 }
38 return out == "enabled\n", nil
39}
40
41func (s *Systemd) IsExist(serviceName string) (bool, error) {
42 out, err := run(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