From f3d2dbd08ed3a776f9f996368f3dbb15602b7951 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 19 十二月 2019 10:47:31 +0800 Subject: [PATCH] add log --- service/SysService.go | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/service/SysService.go b/service/SysService.go index 813fc3d..5de188c 100644 --- a/service/SysService.go +++ b/service/SysService.go @@ -1,4 +1,5 @@ package service + import ( "basic.com/valib/logger.git" "bufio" @@ -7,7 +8,6 @@ "mime/multipart" "os" "os/exec" - "strconv" "strings" "webserver/extend/config" "webserver/extend/util" @@ -66,7 +66,8 @@ return true } //鍒ゆ柇鍒嗗潡鏂囦欢鏄惁瀛樺湪 - chunkFilePath := fileTmpPath+"/"+arg.Identifier+"_"+strconv.Itoa(arg.ChunkNumber) + chunkAlignNum := util.FormatNum(arg.TotalChunks, arg.ChunkNumber) + chunkFilePath := fileTmpPath+"/"+arg.Identifier+"_"+chunkAlignNum if !util.Exists(chunkFilePath) { return false } @@ -110,7 +111,8 @@ return false } } - fileSavePath := fileTmpPath+"/"+MD5Str+"_"+strconv.Itoa(arg.ChunkNumber) + chunkAlignNum := util.FormatNum(arg.TotalChunks, arg.ChunkNumber) + fileSavePath := fileTmpPath+"/"+MD5Str+"_"+chunkAlignNum if util.Exists(fileSavePath) { rmErr := os.Remove(fileSavePath) if rmErr != nil { @@ -148,6 +150,8 @@ if !updatePatch(arg.Identifier, subfix) { return false } + } else { + logger.Debug("not a valid zip file,path:",fileTmpPath+subfix) } } } @@ -179,12 +183,13 @@ } //2.鏇存柊绯荤粺 var cmd *exec.Cmd - updateCmd := fmt.Sprintf("setsid ./updatePatch.sh %s",unZipPath) + updateCmd := fmt.Sprintf("setsid ./updatePatch.sh %s %s %s",unZipPath,configPatchPath+"/"+identifier+ext,configPatchPath+"/"+identifier) cmd = exec.Command("/bin/sh","-c", updateCmd) - logger.Debug("called sh updatePatch.sh,updateCmd:",updateCmd) if b, err := cmd.Output(); err != nil { logger.Debug("updatePatch err:",err,"result:",string(b)) return false + } else { + logger.Debug("updatePatch result:",string(b),"cmd:",updateCmd) } return true } @@ -192,11 +197,11 @@ func (sv SysService) MergeChunks(chunkPath string, storePath string) bool { var cmd *exec.Cmd cmd = exec.Command("/bin/sh", "-c", fmt.Sprintf("./mergeAll.sh %s %s", chunkPath, storePath)) - logger.Debug("called sh mergeAll.sh ", chunkPath, storePath) if b, err := cmd.Output(); err != nil { logger.Debug("mergeChunks err:", err, "result:", string(b)) return false } else { + logger.Debug("mergeChunks success,cmd: mergeAll.sh ", chunkPath, storePath) return true } } \ No newline at end of file -- Gitblit v1.8.0