ne service action
This commit is contained in:
@@ -790,12 +790,30 @@ func PostNeServiceAction(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
case "ims":
|
||||
actionCmd := fmt.Sprintf("sudo ims-%s", action)
|
||||
cmd := exec.Command("ssh", sshHost, actionCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh sudo ims-%s command:", action, err)
|
||||
switch action {
|
||||
case "start", "stop":
|
||||
actionCmd := fmt.Sprintf("sudo ims-%s", action)
|
||||
cmd := exec.Command("ssh", sshHost, actionCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh sudo ims-%s command:", action, err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
case "restart":
|
||||
actionCmd := "sudo ims-stop && sudo ims-start"
|
||||
cmd := exec.Command("ssh", sshHost, actionCmd)
|
||||
out, err := cmd.CombinedOutput()
|
||||
log.Debugf("Exec output: %v", string(out))
|
||||
if err != nil {
|
||||
log.Error("Faile to execute ssh sudo ims-%s command:", action, err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
default:
|
||||
err = global.ErrCMUnknownServiceAction
|
||||
log.Error("%v, action:%s", err, action)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user