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

Method Restart

agent/app/service/dashboard.go:58–80  ·  view source on GitHub ↗
(operation string)

Source from the content-addressed store, hash-verified

56}
57
58func (u *DashboardService) Restart(operation string) error {
59 switch operation {
60 case "system":
61 {
62 go func() {
63 cmdMgr := cmd.NewCommandMgr()
64 err := cmdMgr.RunWithOptionalSudo("reboot")
65 if err != nil {
66 global.LOG.Errorf("handle reboot failed, %v", err)
67 }
68 }()
69 return nil
70 }
71 case "1panel-agent":
72 controller.RestartPanel(false, true, false)
73 return nil
74 case "1panel":
75 controller.RestartPanel(true, true, false)
76 return nil
77 default:
78 return fmt.Errorf("handle restart operation %s failed, err: nonsupport such operation", operation)
79 }
80}
81
82func (u *DashboardService) LoadOsInfo() (*dto.OsInfo, error) {
83 var baseInfo dto.OsInfo

Callers

nothing calls this directly

Calls 1

RunWithOptionalSudoMethod · 0.80

Tested by

no test coverage detected