From d6d8a805bfdf672ebe6fbe401031edb517fc34fe Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期四, 16 四月 2020 15:27:39 +0800
Subject: [PATCH] fix startup item

---
 controllers/swfsControllers.go |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/controllers/swfsControllers.go b/controllers/swfsControllers.go
index d7dfbd1..fcb3dbb 100644
--- a/controllers/swfsControllers.go
+++ b/controllers/swfsControllers.go
@@ -101,14 +101,14 @@
 
 //鍚姩鏈嶅姟
 func StartServer(scriptPath string) {
-	fmt.Println("sh " + scriptPath + StartServerScript)
-	util.RunScript("sh " + scriptPath + StartServerScript)
+	//fmt.Println("sh " + scriptPath + "/" + StartServerScript)
+	util.RunScript("sh " + scriptPath + "/" + StartServerScript)
 }
 
 //鍋滄鏈嶅姟
 func StopServer(scriptPath string) {
-	fmt.Println("sh " + scriptPath + StopServerScript)
-	util.RunScript("sh " + scriptPath + StopServerScript)
+	//fmt.Println("sh " + scriptPath + "/" + StopServerScript)
+	util.RunScript("sh " + scriptPath + "/" + StopServerScript)
 }
 
 //鏍规嵁鎼滅储鍐呭鏇挎崲鏁磋鍐呭
@@ -164,9 +164,10 @@
 	}
 	fmt.Println("res: ", res)
 	startupItem := res["data"].(string)
-	if httpRes.StatusCode == 200 {
-		startupItem = string(body)
+	if httpRes.StatusCode != 200 {
+		return
 	}
+	fmt.Println("Restart startupItem: ", startupItem)
 	tick := time.Tick(1 * time.Second)
 	fmt.Println("鍑嗗寮�濮嬮獙璇佽妭鐐规湇鍔�")
 	for countdown := timeOut; countdown > 0; countdown-- {
@@ -184,9 +185,10 @@
 //楠岃瘉鏈嶅姟鐘舵��
 func Verification(startupItem string, ip string) bool {
 	resStatu := false
+	fmt.Println("Verification startupItem: ", startupItem)
 	switch startupItem {
 	case StartScriptAsVolume:
-		verificationVolumeUrl := "http://" + ip + ":6700"
+		verificationVolumeUrl := "http://" + ip + ":6700/ui/index.html"
 		_, volume1Err := http.Get(verificationVolumeUrl)
 		if volume1Err == nil {
 			resStatu = true
@@ -199,9 +201,11 @@
 		}
 	case StartScriptAsMaVo:
 		verificationMasterUrl := "http://" + ip + ":6333"
-		verificationVolumeUrl := "http://" + ip + ":6700"
+		verificationVolumeUrl := "http://" + ip + ":6700/ui/index.html"
 		_, masterErr := http.Get(verificationMasterUrl)
+		fmt.Println("masterErr", masterErr)
 		_, volume1Err := http.Get(verificationVolumeUrl)
+		fmt.Println("volume1Err", volume1Err)
 		if masterErr == nil && volume1Err == nil {
 			resStatu = true
 		}

--
Gitblit v1.8.0