This commit is contained in:
zhangkun9038@dingtalk.com 2022-09-10 11:21:19 +00:00
parent 14d4970e82
commit 291a3e314b
2 changed files with 23 additions and 7 deletions

View File

@ -8,7 +8,7 @@ fileName=$1
projectPath=$2 projectPath=$2
serviceName=$3 serviceName=$3
workDirectory=$4 workDirectory=$4
ossPath=$5 ossLogPath=$5
PATH=PATH:/usr/bin:/usr/sbin PATH=PATH:/usr/bin:/usr/sbin
@ -16,7 +16,7 @@ function uploadLog ()
{ {
echo "current user is ${USER}" echo "current user is ${USER}"
journalctl -n 1000 -xe -t autoDeploy > ${workDirectory}autoDeploy.log journalctl -n 1000 -xe -t autoDeploy > ${workDirectory}autoDeploy.log
${workDirectory}ossutil cp ${workDirectory}autoDeploy.log oss://ztupload/${ossPath}autoDeploy.log ${workDirectory}ossutil cp ${workDirectory}autoDeploy.log oss://ztupload/${ossLogPath}autoDeploy.log
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "error: upload log to oss failed!" echo "error: upload log to oss failed!"
exit 0 exit 0
@ -43,7 +43,7 @@ function compare(){
cd $projectPath cd $projectPath
desSum="" desSum=""
if [ ! -f "$fileName" ];then if [ ! -f "$fileName" ];then
cp ~/$fileName . cp $workDirectory$fileName .
return 0 return 0
else else
desSum=$(md5sum $fileName) desSum=$(md5sum $fileName)

View File

@ -44,7 +44,7 @@ function compare(){
fi fi
} }
function process(){ function downloadFromOss(){
cd ~ cd ~
rm $fileName rm $fileName
echo "fileName: " $fileName echo "fileName: " $fileName
@ -61,6 +61,16 @@ function process(){
# fi # fi
# } # }
# function isFrontEnd(){
# result=$(echo $fileName | grep ".zip")
# if [[ "$result" != "" ]]; then
# return 0
# else
# return 1
# fi
# }
function main(){ function main(){
echo " " echo " "
echo "start ossUpgrade service" echo "start ossUpgrade service"
@ -77,10 +87,16 @@ function main(){
echo "local temp file $fileName is different from oss, will download..." echo "local temp file $fileName is different from oss, will download..."
fi fi
process downloadFromOss
sleep 10
# uploadLog # uploadLog
echo "replaced" 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 "end ossUpgrade service"
echo " " echo " "
} }