mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-10 23:47:39 +08:00
fix: Fix the problem of abnormal operation of the script library (#8517)
This commit is contained in:
parent
b0a7efe9c3
commit
a3f6dc334f
1 changed files with 2 additions and 2 deletions
|
@ -147,7 +147,7 @@ func (b *BaseApi) RunScript(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
scriptID := c.Query("script_id")
|
scriptID := c.Query("script_id")
|
||||||
currentNode := c.Query("current_node")
|
currentNode := c.Query("operateNode")
|
||||||
intNum, _ := strconv.Atoi(scriptID)
|
intNum, _ := strconv.Atoi(scriptID)
|
||||||
if intNum == 0 {
|
if intNum == 0 {
|
||||||
if wshandleError(wsConn, fmt.Errorf(" no such script %v in library, please check and try again!", scriptID)) {
|
if wshandleError(wsConn, fmt.Errorf(" no such script %v in library, please check and try again!", scriptID)) {
|
||||||
|
@ -183,7 +183,7 @@ func (b *BaseApi) RunScript(c *gin.Context) {
|
||||||
|
|
||||||
fileDir := path.Join(installDir, "1panel/tmp/script")
|
fileDir := path.Join(installDir, "1panel/tmp/script")
|
||||||
fileName := path.Join(fileDir, uuid.NewString())
|
fileName := path.Join(fileDir, uuid.NewString())
|
||||||
initCmd := fmt.Sprintf("mkdir -p %s && cat > %s <<'EOF'\n%s\nEOF\n bash %s", fileDir, fileName, scriptItem.Script, fileName)
|
initCmd := fmt.Sprintf("mkdir -p %s && cat > %s <<'MYMARKER'\n%s\nMYMARKER\n bash %s", fileDir, fileName, scriptItem.Script, fileName)
|
||||||
client, err := ssh.NewClient(*connInfo)
|
client, err := ssh.NewClient(*connInfo)
|
||||||
if wshandleError(wsConn, errors.WithMessage(err, "failed to set up the connection. Please check the host information")) {
|
if wshandleError(wsConn, errors.WithMessage(err, "failed to set up the connection. Please check the host information")) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue