sunty
2020-04-16 4cfdbeb86fd594080b4b6d258393969c2b2f2054
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)