datacenter update & oss temp file in individual folder

This commit is contained in:
zhangkun9038@dingtalk.com 2022-09-29 05:33:33 +00:00
parent 4410182805
commit a4a26b5440
23 changed files with 105 additions and 22 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,8 +3,9 @@ fileName=$1
projectPath=$2
PATH=PATH:/usr/bin:/usr/sbin
sleep 15
cd ~
basePath=/tmp/autoDeploy
sleep 1
cd $basePath
echo "current path: $(pwd)"
if [ ! -f "$fileName" ];then
echo "文件 $fileName 不存在1!"
@ -23,7 +24,7 @@ fi
cd $projectPath
desSum=""
if [ ! -f "$fileName" ];then
cp ~/$fileName .
cp $basePath/$fileName .
exit 0
else
desSum=$(md5sum $fileName)
@ -50,7 +51,7 @@ if [ -f "$fileName" ];then
mv ${fileName} ${fileName}_bak
fi
cp ~/"${fileName}" .
cp $basePath/"${fileName}" .
result=$?
if [ $result = 0 ];then
echo "file ${fileName} in ${projectPath} upgraded."

View File

@ -8,7 +8,9 @@ dbName=$5
backUpPath=$6
ossPath=$7
cd ~
basePath=~/tmp/autoDeploy
cd basePath
/usr/bin/mysqldump --opt --protocol=TCP --user=${dbUser} --password=${dbPassword} --host=${dbHost} --port=${dbPort} ${dbName} > ${dbName}.sql
cd $backUpPath

View File

@ -21,7 +21,7 @@ function uploadLog()
count=$3
echo "current user is ${USER}"
journalctl -n $count -xe -${ctype} $identify | grep -wv " at " > ${workPath}/${identify}.log
${workPath}/ossutil cp -f ${workPath}/${identify}.log oss://ztupload/${ossLogPath}/logs/${identify}.log
~/ossutil cp -f ${workPath}/${identify}.log oss://${ossLogPath}/logs/${identify}.log
if [ $? -eq 0 ]; then
echo "ok: log ${identify} uploaded to oss!"
return 0
@ -83,6 +83,7 @@ function restart(){
rm -f ${ossInfoProjectPath}
cp ${ossInfoTempPath} ${projectPath}
cp ${workPath}/${preName}_md5.txt ${projectPath}
}
function main(){

View File

@ -19,7 +19,7 @@ function uploadLog()
count=$3
echo "current user is ${USER}"
journalctl -n $count -xe -${ctype} $identify > ${workPath}/${identify}.log
${workPath}/ossutil cp -f ${workPath}/${identify}.log oss://ztupload/${ossLogPath}/logs/${identify}.log
${workPath}/ossutil cp -f ${workPath}/${identify}.log oss://${ossLogPath}/logs/${identify}.log
if [ $? -eq 0 ]; then
echo "ok: log ${identify} uploaded to oss!"
return 0
@ -107,7 +107,7 @@ function replaceFile(){
}
function verify() {
cd ~
cd /tmp/autoDeploy
cd $projectPath/${preName}
echo "the md5sum injected in ${projectPath}/${preName} is $(cat ${preName}_md5.txt)"
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
cd ~
cd /tmp/autoDeploy
./ossutil stat oss://ztupload/html.zip > html_oss.info
ossInfo=$(cat html_oss.info)
out1=${ossInfo##*Etag}

View File

@ -7,12 +7,13 @@ ossPath=$1 #末尾别忘了加/
fileName=$2
projectName="${fileName%.*}"
basePath=/tmp/autoDeploy
function compare(){
cd ~
cd $basePath
if [ ! -f ${projectName}_oss.info ]; then
touch ${projectName}_oss.info
fi
(./ossutil stat oss://ztupload/${ossPath}$fileName | head -n -2) > ${projectName}_upstream_oss.info
(./ossutil stat oss://${ossPath}$fileName | head -n -2) > ${projectName}_upstream_oss.info
upstreamOssInfoMd5=$(md5sum ${projectName}_upstream_oss.info)
upstreamOssInfoMd5="${upstreamOssInfoMd5% *}"
locOssInfoMd5=$(md5sum ${projectName}_oss.info)
@ -31,11 +32,12 @@ function compare(){
}
function downloadFromOss(){
cd ~
rm $fileName
cd $basePath
echo "fileName: " $fileName
./ossutil cp oss://ztupload/${ossPath}${fileName} ${fileName}
(./ossutil stat oss://ztupload/${ossPath}$fileName | head -n -2) > ${projectName}_oss.info
./ossutil cp oss://${ossPath}${fileName} ${fileName}_tmp
rm $fileName
mv ${fileName}_tmp $fileName
(./ossutil stat oss://${ossPath}$fileName | head -n -2) > ${projectName}_oss.info
}
function main(){

View File

@ -10,16 +10,12 @@ function startModule()
#${JAVA_HOME}bin/java -Xms256m -Xmx512m -Xss512K -Dspring.profiles.active=${profile} -Dspring.config.location=file:${dataCenterPath}/config/ -jar jars/${moduleName}.jar &
${JAVA_HOME}bin/java -Dspring.profiles.active=${profile} -jar jars/${moduleName}.jar &
# > logs/${moduleName}.log &
echo "${!}" > pids/${moduleName}.pid
echo "${!}" > pids/common/${moduleName}.pid
sleep 1
}
function main(){
cd ${dataCenterPath}
startModule zlt-uaa
startModule user-center
startModule sc-gateway
startModule back-web
startModule data-collection
startModule data-metadata-collect-fileset
startModule data-metadata-collect
@ -31,6 +27,7 @@ function main(){
startModule data-standard
startModule data-metadata-interface
startModule data-asset
startModule data-metadata-dic
}
main

27
startDataCenterBase.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
PATH=$PATH:/usr/bin/:/usr/local/bin/:/usr/sbin
dataCenterPath=$1
profile=$2
function startModule()
{
moduleName=$1
#${JAVA_HOME}bin/java -Xms256m -Xmx512m -Xss512K -Dspring.profiles.active=${profile} -Dspring.config.location=file:${dataCenterPath}/config/ -jar jars/${moduleName}.jar &
${JAVA_HOME}bin/java -Dspring.profiles.active=${profile} -jar jars/${moduleName}.jar &
# > logs/${moduleName}.log &
echo "${!}" > pids/base/${moduleName}.pid
sleep 1
}
function main(){
cd ${dataCenterPath}
startModule zlt-uaa
startModule user-center
startModule sc-gateway
startModule back-web
}
main

View File

@ -10,7 +10,7 @@ function killIt()
function fetch()
{
for file in ${dataCenterPath}/pids/*.pid
for file in ${dataCenterPath}/pids/common/*.pid
do
if [ -f "$file" ]
then

27
stopDataCenterBase.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
PATH=$PATH:/usr/bin/:/usr/local/bin/:/usr/sbin
dataCenterPath=$1
function killIt()
{
pid=$1
kill -9 ${pid}
}
function fetch()
{
for file in ${dataCenterPath}/pids/base/*.pid
do
if [ -f "$file" ]
then
killIt $(cat $file) | true
fi
done
}
function main()
{
fetch
}
main

View File

@ -6,4 +6,4 @@ ossPath=$1 #末尾别忘了加/
serviceName=$2
sudo journalctl -n 2000 -xeu $serviceName > ${serviceName}.log
./ossutil cp ${serviceName}.log > oss://ztupload/${ossPath}
./ossutil cp ${serviceName}.log > oss://${ossPath}

15
upload.sh Executable file
View File

@ -0,0 +1,15 @@
dataCenterPath=~/data_center
function fetch()
{
for file in ${dataCenterPath}/jars/*.jar
do
if [ -f "$file" ]
then
fileName=${file##*/}
~/ossutil cp -f $file oss://ztupload/stage/dataCenter/backEnd/$fileName &
echo file: $fileName
fi
done
}
fetch