diff --git a/backEndUpgrade.sh b/backEndUpgrade.sh index e871931..1fcc80f 100755 --- a/backEndUpgrade.sh +++ b/backEndUpgrade.sh @@ -51,3 +51,10 @@ if [ -f "$fileName" ];then fi cp ~/"${fileName}" . +result=$? +if [ $result = 0 ];then + echo "file ${fileName} in ${projectPath} upgraded." +fi +newSum=$(md5sum $fileName) +newSum="${newSum% *}" +echo "the md5sum of new file is ${newSum} " diff --git a/checkService.sh b/checkService.sh index ab00322..0707d23 100755 --- a/checkService.sh +++ b/checkService.sh @@ -44,7 +44,7 @@ function compare(){ echo "origin local temp file $fileName md5sum: |${oriSum}|" if [ ! -d "$projectPath" ]; then - echo "文件夹 $prjectPath 不存在!" + echo "文件夹 $projectPath 不存在!" return -1 fi @@ -57,7 +57,7 @@ function compare(){ desSum=$(md5sum $fileName) desSum="${desSum% *}" echo "current path: $(pwd)" - echo "locfile in projectPath ${fileName} md5sum: |${desSum}|" + echo "locfile in $projectPath ${fileName} md5sum: |${desSum}|" fi if [ ${oriSum} = ${desSum} ];then @@ -73,6 +73,8 @@ function restart(){ systemctl restart $serviceName if [ $? -ne 0 ]; then echo "error: systemctl restart ${serviceName} failed!" + sleep 3 + uploadLog t "autoDeploy" 100 exit 0 fi echo "ok: systemctl restart ${serviceName} success!" @@ -101,7 +103,7 @@ function main(){ exit 0 fi restart - sleep 15 + sleep 45 uploadLog u $serviceName 500 echo "ok: checkService done" echo " " diff --git a/frontEndUpgrade.sh b/frontEndUpgrade.sh index 3034c5d..0e9a0bc 100755 --- a/frontEndUpgrade.sh +++ b/frontEndUpgrade.sh @@ -106,6 +106,11 @@ function replaceFile(){ return 0 } +function verify() { + cd ~ + cd $projectPath/${preName} + echo "the md5sum injected in ${projectPath}/${preName} is $(cat ${preName}_md5.txt)" +} function main() { echo " " @@ -130,8 +135,10 @@ function main() { echo "error: replace faild" exit 0 fi - uploadLog t autoDeploy 100 + sleep 3 + verify echo " " + uploadLog t autoDeploy 100 } main diff --git a/ossUpgrade.sh b/ossUpgrade.sh index 36dc0c6..68e51a3 100755 --- a/ossUpgrade.sh +++ b/ossUpgrade.sh @@ -39,26 +39,6 @@ function downloadFromOss(){ (./ossutil stat oss://ztupload/${ossPath}$fileName | head -n -2) > ${projectName}_oss.info } -# function uploadLog(){ - # logPath=${ossPath%/*} - # logPath=${logPath%/*}/logs/ - # osslogPath=oss://ztupload/${logPath}autoDeploy.log - # journalctl -n 1000 -xe -t autoDeploy > ~/autoDeploy.log - # if [ $? = 0 ];then - # echo "uploaded log to ${osslogPath}" - # fi -# } - -# function isFrontEnd(){ - # result=$(echo $fileName | grep ".zip") - # if [[ "$result" != "" ]]; then - # return 0 - # else - # return 1 - # fi -# } - - function main(){ echo " " echo "start ossUpgrade service" @@ -67,23 +47,13 @@ function main(){ if [ $result = 0 ];then # uploadLog echo "local temp file $fileName is same with oss file,no need to replace" - exit 0 echo "end ossUpgrade service" echo " " + exit 0 else echo "local temp file $fileName is different from oss, will download..." fi - downloadFromOss - # uploadLog - echo "local temp file replaced" - # isFrontEnd - # result=$? - # if [ $result = 0 ];then - # preName=${fileName%/*} - # echo "frontEnd package ${preName} will cover to projectPath" -# - # fi echo "end ossUpgrade service" echo " " }