Skip to content

Commit

Permalink
Merge pull request #2172 from actiontech/issues-2164
Browse files Browse the repository at this point in the history
issues-2164: SQLE3启动脚本:实际启动失败,但输出启动成功
  • Loading branch information
LordofAvernus authored Dec 21, 2023
2 parents 2984ec4 + a07c6d4 commit 9caa689
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions scripts/init_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,39 @@

# 本脚本用于在rpm安装完成后,启动dms服务和sqled服务

detectSystemServiceStatus() {
detectedRunningTimes=0
for i in {1..10}; do
sleep 1
if systemctl status "$1" &>/dev/null; then
((detectedRunningTimes++))
if [[ $detectedRunningTimes == 3 ]]; then
return 0
fi
else
detectedRunningTimes=0
fi
done

return 1
}

systemctl daemon-reload
systemctl start dms.service

for i in {1..10}; do
systemctl status dms.service &>/dev/null
if [ $? -eq 0 ]; then
echo "Init and start dms success!"
break
fi
sleep 1
done
# 10秒dms还没有启动成功退出
if detectSystemServiceStatus "dms.service"; then
echo "init and start dms success!"
else
echo "duration 10 seconds; start dms failed"
exit 3
fi

systemctl start sqled.service
for i in {1..10}; do
systemctl status sqled.service &>/dev/null
if [ $? -eq 0 ]; then
echo "Init and start sqled success!"
exit 0
fi
sleep 1
done

echo "init and start sqle fail! Please check sqle log"
# 10秒sqle还没有启动成功退出
if detectSystemServiceStatus "sqled.service"; then
echo "init and start sqled success!"
else
echo "duration 10 seconds; start sqled failed"
fi

0 comments on commit 9caa689

Please sign in to comment.