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

Function New

core/utils/controller/controller.go:27–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27func New() (Controller, error) {
28 managerOptions := []string{"systemctl", "rc-service", "service"}
29 for _, item := range managerOptions {
30 if _, err := exec.LookPath(item); err != nil {
31 continue
32 }
33 switch item {
34 case "systemctl":
35 return manager.NewSystemd(), nil
36 case "rc-service":
37 return manager.NewOpenrc(), nil
38 case "service":
39 return manager.NewSysvinit(), nil
40 }
41 }
42 return nil, errors.New("not support such manager initializatio")
43}
44
45func NewWithClient(client *ssh.SSHClient) (Controller, error) {
46 managerOptions := []string{"systemctl", "rc-service", "service"}

Callers 10

HandleFunction · 0.70
CheckExistFunction · 0.70
CheckActiveFunction · 0.70
CheckEnableFunction · 0.70
ReloadFunction · 0.70
RestartPanelFunction · 0.70
LoadServiceNameFunction · 0.70
GetServicePathFunction · 0.70
SelectInitScriptFunction · 0.70
GetScriptNameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected