checkService.sh revert

This commit is contained in:
zhangkun9038@dingtalk.com 2024-03-01 14:36:41 +08:00
parent d4badff4bf
commit 159cf27603

View File

@ -71,7 +71,7 @@ function compare(){
if [ ${oriSum} = ${desSum} ];then
#journalctl -n 1000 -xe -t autoDeploy > ${workPath}/autoDeploy.log
return 0
else
else
echo $oriSum > ${workPath}/${fileName}_md5.txt
return 1
fi
@ -79,7 +79,7 @@ function compare(){
function restart(){
sleep 4
#systemctl restart $serviceName
systemctl restart $serviceName
if [ $? -ne 0 ]; then
echo "error: systemctl restart ${serviceName} failed!"
sleep 3
@ -92,7 +92,7 @@ function restart(){
echo ossInfoTempPath: $ossInfoTempPath
echo ossInfoProjectPath: $ossInfoProjectPath
rm -f ${ossInfoProjectPath}
cp ${ossInfoTempPath} ${projectPath}
cp ${ossInfoTempPath} ${projectPath}
cp ${workPath}/${fileName}_md5.txt ${projectPath}
}
@ -103,7 +103,7 @@ function main(){
compare
result=$?
echo "result $result"
if [ $result = 0 ];then
if [ $result = 0 ];then
# uploadLog
echo "local temp file ${fileName} is same with file in ${projectPath} no need to replace"
echo "ok: checkService done"
@ -111,7 +111,7 @@ function main(){
exit 0
elif [ $result = 1 ]; then
echo "local temp file $fileName is different from ${projectPath}, will replace..."
else
else
exit 0
fi
restart
@ -122,4 +122,4 @@ function main(){
exit 0
}
main
main