This commit is contained in:
2023-08-20 14:42:46 +08:00
parent dcd961ee86
commit e4fe101e4d
12 changed files with 119 additions and 3 deletions

View File

@@ -7,7 +7,6 @@ import (
"fmt"
"math"
"net/http"
"os/exec"
"regexp"
"strconv"
"strings"
@@ -15,6 +14,7 @@ import (
"ems.agt/lib/dborm"
"ems.agt/lib/global"
"ems.agt/lib/log"
"ems.agt/lib/run"
"github.com/go-resty/resty/v2"
)
@@ -38,6 +38,7 @@ type MmlCommand struct {
type MmlVar struct {
Version string `json:"version"`
Output string `json:"output"`
MmlHome string `json:"mmlHome"`
Limit int `json:"limit"`
User string `json:"user"`
SessionToken string `josn:"sessionToken"`
@@ -437,8 +438,10 @@ func RunShellCommand(mml *MmlCommand, omcMmlVar *MmlVar, outputJson *dborm.MmlOu
default:
}
}
cmd := exec.Command("/bin/bash", "-c", command)
out, err := cmd.CombinedOutput()
out, err := run.ExecCmd(command, omcMmlVar.MmlHome)
//cmd := exec.Command("/bin/bash", "-c", command)
//out, err := cmd.CombinedOutput()
log.Tracef("Exec output: %v", string(out))
if err != nil {
log.Error("exe cmd error: ", err)