From 9c843dbb62ac9bdaba3d92a9703022ab186ab075 Mon Sep 17 00:00:00 2001 From: Endial Fang Date: Fri, 22 Sep 2023 09:04:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/usr/local/bin/common.sh | 21 +++++++++++---------- customer/usr/local/bin/run.sh | 6 +++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/customer/usr/local/bin/common.sh b/customer/usr/local/bin/common.sh index 3f418fa..b0f4c27 100644 --- a/customer/usr/local/bin/common.sh +++ b/customer/usr/local/bin/common.sh @@ -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 diff --git a/customer/usr/local/bin/run.sh b/customer/usr/local/bin/run.sh index a3842ca..da9e305 100755 --- a/customer/usr/local/bin/run.sh +++ b/customer/usr/local/bin/run.sh @@ -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[@]}"