Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 使用脚本执行插件配置,脚本在最后应该restart服务 #2699

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
littleniannian marked this conversation as resolved.
Show resolved Hide resolved
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
Loading