zou.yingbin %!s(int64=4) %!d(string=hai) anos
pai
achega
f4048c3945
Modificáronse 1 ficheiros con 1 adicións e 25 borrados
  1. 1 25
      controllers/other/update.go

+ 1 - 25
controllers/other/update.go

@@ -9,7 +9,6 @@ package other
 
 import (
 	_ "embed"
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"mtp2_if/logger"
 	"net/http"
@@ -50,7 +49,7 @@ func MakeUpdateScript(c *gin.Context) {
 		names := rx.FindStringSubmatch(filename)
 		// 正则表达式检查文件名是否符合规范
 		if len(names) > 0 && names[0] == filename {
-			_ = exec.Command("sh", fmt.Sprintf("./update.sh %v", filename)).Run()
+			_ = exec.Command("sh", "./update.sh", filename).Run()
 		} else {
 			_ = exec.Command("sh", "./update.sh").Run()
 		}
@@ -68,31 +67,8 @@ func createsh() bool {
 		return false
 	}
 
-	sh :=
-		"# author : zyb\n" +
-			"# note   : 在程序运行目录执行此脚本, 升级go服务到最新构建的版本。升级完成自动重启go服务\n" +
-			"# --------------------------------------------------------------------\n" +
-			"\n" +
-			"mkdir -p upmtpgo\n" +
-			"cd upmtpgo\n" +
-			"rm -f console\n" +
-			"wget -c http://192.168.30.153:8080/view/mtp2.0_release/job/mtp2.0_QueryService_linux/label=192.168.31.56/lastBuild/console\n" +
-			"filename=`grep -o -w -m1 mtp2.*zip console`\n" +
-			"wget -c http://192.168.30.153/share/build/mtp2.0_release/$filename\n" +
-			"rm -rf queryservice\n" +
-			"unzip $filename -d queryservice\n" +
-			"cp ../config/config.xml ./queryservice/config/config.xml\n" +
-			"cp ../config/cfg.json ./queryservice/config/cfg.json\n" +
-			"cp -rf ./queryservice/* ../\n" +
-			"cd ..\n" +
-			"rm -rf upmtpgo\n" +
-			"pkill QueryService\n" +
-			"nohup `pwd`/QueryService &" +
-			"rm -f update.sh"
-
 	// 创建文件
 	if f, err := os.OpenFile(dir+"/update.sh", os.O_RDWR|os.O_CREATE, 0666); err == nil {
-		_ = sh
 		_, err = f.Write([]byte(strShell))
 		f.Close()
 	} else {