feat: 更新脚本文件

This commit is contained in:
2023-09-22 09:04:45 +08:00
parent 095f1dade9
commit 9c843dbb62
2 changed files with 14 additions and 13 deletions
+11 -10
View File
@@ -109,7 +109,7 @@ app_common_conf_set() {
# 使用环境变量中配置,更新配置文件
app_update_conf() {
LOG_I "Update configure files..."
LOG_I "Update configure files from APP_CFG_*..."
app_configure_from_environment "${APP_CONF_FILE}" "APP_CFG"
}
@@ -139,11 +139,12 @@ app_verify_minimum_env() {
}
# 检测认证设置。如果不允许匿名登录,检测登录用户名及密码是否设置
# if is_boolean_yes "$ALLOW_ANONYMOUS"; then
# LOG_W "You have set the environment variable ALLOW_ANONYMOUS=${ALLOW_ANONYMOUS}. For safety reasons, do not use this flag in a production environment."
# elif ! is_boolean_yes "$ZOO_ENABLE_AUTH"; then
if is_boolean_yes "${ALLOW_ANONYMOUS}"; then
LOG_W "You have set the environment variable ALLOW_ANONYMOUS=${ALLOW_ANONYMOUS}. For safety reasons, do not use this flag in a production environment."
else
# 检测相应密码是否设置
# print_validation_error "The ZOO_ENABLE_AUTH environment variable does not configure authentication. Set the environment variable ALLOW_ANONYMOUS=yes to allow unauthenticated users to connect to ZooKeeper."
# fi
fi
# TODO: 其他参数检测
@@ -239,7 +240,7 @@ app_start_server_bg() {
app_stop_server() {
app_is_server_not_running && return
LOG_I "Stopping ${APP_NAME}..."
LOG_I "Stopping ${APP_NAME} background service..."
# 使用 debug_execute 关闭服务
# debug_execute "zkServer.sh" stop
@@ -285,7 +286,7 @@ app_is_server_not_running() {
if [[ app_is_server_running == false ]]; then
true
else
flse
false
fi
}
@@ -349,7 +350,7 @@ app_custom_init() {
local tarFile="initdb-$(date '+%Y-%m-%d-%H%M%S').tar"
tar --remove-files -cf "${tarFile}" "${APP_CONF_DIR}/initdb.d/initdb_info"
# 启动后台服务
# 禁用远程访问,并启动后台服务
app_disable_remote_connections
app_start_server_bg
@@ -375,8 +376,8 @@ app_custom_init() {
tar --remove-files -f "${tarFile}" -r "${f}"
done
# 检测服务是否运行中;如果运行,则停止后台服务
app_is_server_running && app_stop_server
# 停止后台服务,并启用远程访问
app_stop_server
app_clean_tmp_file
app_enable_remote_connections
fi
+3 -3
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# Ver: 1.6 by Endial Fang (endial@126.com)
# Ver: 1.7 by Endial Fang (endial@126.com)
#
# 应用启动脚本;组合默认的配置参数及容器启动时传入的 CMD 参数,启动应用
@@ -20,5 +20,5 @@ flags=()
[[ -n "${APP_EXTRA_FLAGS:-}" ]] && flags+=("${APP_EXTRA_FLAGS[@]}")
flags+=("$@")
LOG_I "Start ${APP_NAME} with command: ${START_COMMAND[@]} ${flags[@]}"
exec "${START_COMMAND[@]}" "${flags[@]}"
LOG_I "Start ${APP_NAME} with command: ${START_COMMAND} ${flags[@]}"
exec "${START_COMMAND}" "${flags[@]}"