From b1b0830cf604155bc1271132e68bf6e0b4998b17 Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期四, 16 四月 2020 15:14:48 +0800 Subject: [PATCH] fix verification ui/html --- controllers/swfsControllers.go | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/controllers/swfsControllers.go b/controllers/swfsControllers.go index 98f2f49..c479112 100644 --- a/controllers/swfsControllers.go +++ b/controllers/swfsControllers.go @@ -91,8 +91,8 @@ func (sc *SeaweedfsController) RestartServerController(c *gin.Context) { StopServer(config.Server.ScriptPath) - time.Sleep(time.Second * 1) StartServer(config.Server.ScriptPath) + time.Sleep(time.Second * 1) //fmt.Println("GetLocalStartupItem: ", GetLocalStartupItem(config.Server.ScriptPath, StartServerScript)) result := strings.Split(GetLocalStartupItem(config.Server.ScriptPath, StartServerScript), "=")[1] fmt.Println("result: ", result) @@ -101,12 +101,14 @@ //鍚姩鏈嶅姟 func StartServer(scriptPath string) { - util.RunScript("sh " + scriptPath + StartServerScript) + //fmt.Println("sh " + scriptPath + "/" + StartServerScript) + util.RunScript("sh " + scriptPath + "/" + StartServerScript) } //鍋滄鏈嶅姟 func StopServer(scriptPath string) { - util.RunScript("sh " + scriptPath + StopServerScript) + //fmt.Println("sh " + scriptPath + "/" + StopServerScript) + util.RunScript("sh " + scriptPath + "/" + StopServerScript) } //鏍规嵁鎼滅储鍐呭鏇挎崲鏁磋鍐呭 @@ -154,13 +156,13 @@ url := "http://" + ip + ":7020/node/api-v/swfs/restartServer" var info interface{} httpRes, _ := http.Get(url) - defer httpRes.Body.Close() body, _ := ioutil.ReadAll(httpRes.Body) json.Unmarshal(body, &info) res, ok := info.(map[string]interface{}) if !ok { fmt.Println("http response interface can not change map[string]interface{}") } + fmt.Println("res: ", res) startupItem := res["data"].(string) if httpRes.StatusCode == 200 { startupItem = string(body) @@ -184,7 +186,7 @@ resStatu := false switch startupItem { case StartScriptAsVolume: - verificationVolumeUrl := "http://" + ip + ":6700" + verificationVolumeUrl := "http://" + ip + ":6700/ui/index.html" _, volume1Err := http.Get(verificationVolumeUrl) if volume1Err == nil { resStatu = true @@ -197,7 +199,7 @@ } case StartScriptAsMaVo: verificationMasterUrl := "http://" + ip + ":6333" - verificationVolumeUrl := "http://" + ip + ":6700" + verificationVolumeUrl := "http://" + ip + ":6700/ui/index.html" _, masterErr := http.Get(verificationMasterUrl) _, volume1Err := http.Get(verificationVolumeUrl) if masterErr == nil && volume1Err == nil { -- Gitblit v1.8.0