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

Function New

agent/utils/controller/controller.go:26–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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