| | |
| | | if err != nil { |
| | | |
| | | } |
| | | infos := strings.Split(string(out.String()), "\n") |
| | | len := len(infos) |
| | | res := infos[len-1] |
| | | if res == "服务启动成功" { |
| | | infos := strings.Split(string(out.String()), "\n")[0] |
| | | if infos == "服务启动成功" { |
| | | msg = "创建节点成功" |
| | | util.ResponseFormat(c, code.Success, msg) |
| | | return |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | str := "sh /opt/script/create_node.sh " + ac.Option + "" |
| | | str := "sh /opt/script/add_cluster.sh " + ac.Option + "" |
| | | if ac.Option == "1" { |
| | | info, err := updateUnicastHosts(ac.Ip) |
| | | if err != nil || info == false { |
| | |
| | | cmd := exec.Command("sh", "-c", str) |
| | | var out bytes.Buffer |
| | | cmd.Stdout = &out |
| | | err1 := cmd.Run() |
| | | if err1 != nil { |
| | | err := cmd.Run() |
| | | if err != nil { |
| | | return "运行失败" |
| | | } |
| | | return out.String() |