| | |
| | | StopServer(config.Server.ScriptPath) |
| | | time.Sleep(time.Second * 1) |
| | | StartServer(config.Server.ScriptPath) |
| | | result := strings.Split("=", GetLocalStartupItem(config.Server.ScriptPath, StartServerScript))[1] |
| | | //fmt.Println("GetLocalStartupItem: ", GetLocalStartupItem(config.Server.ScriptPath, StartServerScript)) |
| | | result := strings.Split(GetLocalStartupItem(config.Server.ScriptPath, StartServerScript), "=")[1] |
| | | fmt.Println("result: ", result) |
| | | util.ResponseFormat(c, code.Success, result) |
| | | } |
| | | |
| | |
| | | //获取本地启动项 |
| | | func GetLocalStartupItem(scriptPath string, scriptFile string) string { |
| | | startupItem := GetNowLineContent(scriptPath+"/"+scriptFile, Option) |
| | | fmt.Println(startupItem) |
| | | fmt.Println("startupItem: ", startupItem) |
| | | return startupItem |
| | | } |
| | | |
| | |
| | | |
| | | //获取查找内容当前行内容 |
| | | func GetNowLineContent(filePath string, searchContent string) string { |
| | | scriptStr := "cat" + filePath + "| grep " + searchContent |
| | | scriptStr := "cat " + filePath + "| grep " + searchContent |
| | | fmt.Println("scriptStr: ", scriptStr) |
| | | return strings.Split(util.RunScript(scriptStr), "\n")[0] |
| | | } |