提交 3758a8c9 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

restart after upgrade

上级 d50827f7
......@@ -69,6 +69,4 @@ 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
@qshell qupload2 --src-dir=/Users/aaron/work/zentao/qiniu/ --bucket=download --thread-count=10 --log-file=qshell.log \
--skip-path-prefixes=zendata,ztf --rescan-local --overwrite
--skip-path-prefixes=zendata --rescan-local --overwrite
......@@ -5,6 +5,7 @@ go 1.12
require golang.org/x/text v0.3.2
require (
bitbucket.org/kardianos/osext v0.0.0-20181027061946-15c52d0993e9
github.com/ajg/form v1.5.1
github.com/awesome-gocui/gocui v0.6.0
github.com/bitly/go-simplejson v0.5.0
......
......@@ -90,6 +90,8 @@ func (s *UpgradeService) RestartVersion(version string) (err error) {
// update config file
vari.Config.Version, _ = strconv.ParseFloat(version, 64)
configUtils.SaveConfig(vari.Config)
commonUtils.Restart()
}
return
......
......@@ -35,7 +35,7 @@ func Download(uri string, dst string) error {
if err != nil {
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("download_write_fail", dst, err.Error()))
} else {
logUtils.PrintTof("download_success", uri, dst)
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("download_success", uri, dst))
}
return err
......
package commonUtils
import (
"bitbucket.org/kardianos/osext"
"github.com/easysoft/zentaoatf/src/model"
"github.com/easysoft/zentaoatf/src/utils/const"
stringUtils "github.com/easysoft/zentaoatf/src/utils/string"
"github.com/emirpasic/gods/maps"
"net"
"os"
"os/exec"
"path"
"path/filepath"
"reflect"
......@@ -191,3 +193,11 @@ func getIpType(IP net.IP) string {
}
return ""
}
func Restart() error {
name, err := osext.Executable()
if err != nil {
return err
}
return exec.Command(name, os.Args[1:]...).Start()
}
......@@ -95,7 +95,7 @@ func SaveConfig(conf model.Config) error {
cfg.ReflectFrom(&conf)
cfg.SaveTo(configPath)
if i118Utils.I118Prt == nil {
if i118Utils.I118Prt == nil { // first time, i118 may not be init.
logUtils.PrintToWithColor(fmt.Sprintf("Successfully update config file %s.", configPath), color.FgCyan)
} else {
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("success_update_config", configPath), color.FgCyan)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册