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
serviceName=$3
workDirectory=$4
ossPath=$5
ossLogPath=$5
PATH=PATH:/usr/bin:/usr/sbin
@ -16,7 +16,7 @@ function uploadLog ()
{
echo "current user is ${USER}"
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
echo "error: upload log to oss failed!"
exit 0
@ -43,7 +43,7 @@ function compare(){
cd $projectPath
desSum=""
if [ ! -f "$fileName" ];then
cp ~/$fileName .
cp $workDirectory$fileName .
return 0
else
desSum=$(md5sum $fileName)

View File

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