Skip to content

Commit

Permalink
Merge pull request #2699 from actiontech/fix_init_config_restart
Browse files Browse the repository at this point in the history
fix: 使用脚本执行插件配置,脚本在最后应该restart服务
  • Loading branch information
winfredLIN authored Nov 6, 2024
2 parents 52152b9 + d65c9d8 commit 60a384c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -638,4 +638,32 @@ launch_sqle() {
echo "$split_line"
fi
}
# 当stop.sh脚本不存在时返回错误码:2
# 当赋予stop.sh脚本执行权限失败返回错误码:1
restart_sqle() {
# pgrep -x sqled 如果找到sqled进程后返回true
if pgrep -x sqled >/dev/null
then
echo "$split_line"
echo ">>>> 正在重新启动SQLE <<<<"
echo "$split_line"
# 检查 stop_sqle.sh 是否存在
if [ ! -f "$work_directory/scripts/stop_sqle.sh" ]; then
echo "$error stop_sqle.sh 脚本不存在"
echo "$split_line"
return 2
fi
if chmod +x "$work_directory/scripts/stop_sqle.sh"; then
echo "$info stop_sqle.sh 可执行权限配置完成"
else
echo "$error 设置 stop_sqle.sh 执行权限失败"
return 1
fi
# 启动 stop_sqle.sh脚本
bash "$work_directory/scripts/stop_sqle.sh"
launch_sqle
else
launch_sqle
fi
}

4 changes: 3 additions & 1 deletion scripts/init_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ while true; do
fi
fi
done
if ! launch_sqle;then
restart_sqle
error_code=$?
if [ $error_code -ne 0 ];then
echo "$error 启动SQLE失败, 脚本已退出"
fi
break
Expand Down

0 comments on commit 60a384c

Please sign in to comment.