From 4cfdbeb86fd594080b4b6d258393969c2b2f2054 Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期四, 16 四月 2020 15:07:11 +0800
Subject: [PATCH] st server test
---
controllers/swfsControllers.go | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/controllers/swfsControllers.go b/controllers/swfsControllers.go
index 98f2f49..d7dfbd1 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,11 +101,13 @@
//鍚姩鏈嶅姟
func StartServer(scriptPath string) {
+ fmt.Println("sh " + scriptPath + StartServerScript)
util.RunScript("sh " + scriptPath + StartServerScript)
}
//鍋滄鏈嶅姟
func StopServer(scriptPath string) {
+ 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)
--
Gitblit v1.8.0