| | |
| | | |
| | | 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) |
| | |
| | | |
| | | //启动服务 |
| | | 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) |
| | | } |
| | | |
| | |
| | | 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) |