fix: license issue

This commit is contained in:
2024-04-19 15:55:41 +08:00
parent f2739256c8
commit 9713ee90dc

View File

@@ -273,13 +273,13 @@ func UploadLicenseFileData(w http.ResponseWriter, r *http.Request) {
}
// backup system.ini to system.ini.bak
sshHost := fmt.Sprintf("%s@%s", config.GetYamlConfig().NE.User, neInfo.Ip)
cpCmd := fmt.Sprintf("sudo test -f %s/system.ini && cp -f %s/system.ini %s/system.ini.bak",
cpCmd := fmt.Sprintf("sudo test -f %s/system.ini && cp -f %s/system.ini %s/system.ini.bak||echo 0",
neLicensePath, neLicensePath, neLicensePath)
cmd = exec.Command("ssh", sshHost, cpCmd)
out, err = cmd.CombinedOutput()
log.Debugf("Exec output: %v", string(out))
if err != nil {
log.Error("Faile to execute cp command:", err)
log.Errorf("Faile to execute cp command:%v, cmd:%s", err, cpCmd)
services.ResponseInternalServerError500ProcessError(w, err)
return
}