提交 82b0f0d1 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

restart after upgrade

上级 3758a8c9
VERSION=2.3
VERSION=2.7
PROJECT=ztf
QINIU_DIR=/Users/aaron/work/zentao/qiniu/
QINIU_DIST_DIR=${QINIU_DIR}${PROJECT}/${VERSION}/
......@@ -69,4 +69,7 @@ upload_to:
@echo 'upload...'
@find ${QINIU_DIR} -name ".DS_Store" -type f -delete
@qshell qupload2 --src-dir=${QINIU_DIR} --bucket=download --thread-count=10 --log-file=qshell.log \
--skip-path-prefixes=zendata --rescan-local --overwrite
--skip-path-prefixes=zendata --rescan-local
@qshell qupload2 --src-dir=${QINIU_DIR} --bucket=download --thread-count=10 --log-file=qshell.log \
--file-list=${PROJECT}/version.txt --rescan-local --overwrite
Version = 2.3
Version = 2.7
Language = zh
Url = http://zentaopms.ngtesting.com/
Account = admin
Password = P2ssw0rd
Javascript =
Lua =
Perl =
Javascript =
Lua =
Perl =
Php = C:\dev\sdk\php-7.3.9-Win32-VC15-x64\php.exe
Python =
Ruby =
Tcl =
Autoit =
Python =
Ruby =
Tcl =
Autoit =
......@@ -456,11 +456,11 @@
},
{
"id": "success_upgrade",
"translation": "Successfully to update from version %.1f to %s."
"translation": "Successfully upgrade from version %.1f to %s."
},
{
"id": "fail_upgrade",
"translation": "Fail to update from version %.1f to %s., err: %s."
"translation": "Fail to upgrade from version %.1f to %s., err: %s."
},
{
......@@ -486,6 +486,10 @@
{
"id": "perm_deny",
"translation": "Permission denied to file %s, please change work dir."
},
{
"id": "fail_unzip",
"translation": "Fail to unzip file %s."
}
]
}
......@@ -493,6 +493,10 @@
{
"id": "perm_deny",
"translation": "文件%s权限不足,建议切换工作目录。"
},
{
"id": "fail_unzip",
"translation": "解压文件%s失败。"
}
]
}
......@@ -32,7 +32,7 @@ func (s *CronService) Init() {
)
cronUtils.AddTaskFuc(
"CheckUpgrade",
"CheckUpdate",
fmt.Sprintf("@every %ds", serverConst.CheckUpgradeInterval),
func() {
if s.taskService.CheckRunning() { // ignore if task is running
......
......@@ -2,7 +2,7 @@ package service
import (
serverModel "github.com/easysoft/zentaoatf/src/server/domain"
commonUtils "github.com/easysoft/zentaoatf/src/server/utils/common"
"github.com/easysoft/zentaoatf/src/server/utils/common"
serverConst "github.com/easysoft/zentaoatf/src/server/utils/const"
"github.com/easysoft/zentaoatf/src/service/client"
zentaoService "github.com/easysoft/zentaoatf/src/service/zentao"
......@@ -25,7 +25,7 @@ func NewHeartBeatService() *HeartBeatService {
func (s *HeartBeatService) HeartBeat(isBusy bool) {
if sysInfo.OsName == "" {
sysInfo = commonUtils.GetSysInfo()
sysInfo = serverUtils.GetSysInfo()
}
// send request
......
......@@ -62,6 +62,10 @@ func (s *UpgradeService) DownloadVersion(version string) (err error) {
fileUtils.RmDir(dir)
fileUtils.MkDirIfNeeded(dir)
err = archiver.Unarchive(pth, dir)
if err != nil {
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("fail_unzip", pth), color.FgCyan)
}
}
return
......
......@@ -6,6 +6,7 @@ import (
"github.com/easysoft/zentaoatf/src/utils/const"
stringUtils "github.com/easysoft/zentaoatf/src/utils/string"
"github.com/emirpasic/gods/maps"
"log"
"net"
"os"
"os/exec"
......@@ -196,8 +197,16 @@ func getIpType(IP net.IP) string {
func Restart() error {
name, err := osext.Executable()
log.Println("Try to restart " + name)
if err != nil {
log.Println("Restart error 1 " + err.Error())
return err
}
return exec.Command(name, os.Args[1:]...).Start()
err = exec.Command(name, os.Args[1:]...).Start()
if err != nil {
log.Println("Restart error 2 " + err.Error())
}
return err
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册