diff --git a/customer/usr/local/bin/common.sh b/customer/usr/local/bin/common.sh index afe7162..83b8316 100644 --- a/customer/usr/local/bin/common.sh +++ b/customer/usr/local/bin/common.sh @@ -27,15 +27,15 @@ app_ensure_config_file_exist() { local f="" shift 2 - LOG_D "List to check in ${base_path}: $@" + debug "List to check in ${base_path}: $@" while [ "$#" -gt 0 ]; do f="${1}" - LOG_D " Process \"${f}\"" + debug " Process \"${f}\"" if [ -d "${base_path}/${f}" ]; then - [[ ! -d "${dist_path}/${f}" ]] && LOG_D " Create directory: ${dist_path}/${f}" && mkdir -p "${dist_path}/${f}" + [[ ! -d "${dist_path}/${f}" ]] && debug " Create directory: ${dist_path}/${f}" && mkdir -p "${dist_path}/${f}" [[ ! -z $(ls -A "${base_path}/${f}") ]] && app_ensure_config_file_exist "${dist_path}/${f}" "${base_path}/${f}" $(ls -A "${base_path}/${f}") else - [[ ! -e "${dist_path}/${f}" ]] && LOG_D " Copy: ${base_path}/${f} to ${dist_path}" && cp "${base_path}/${f}" "${dist_path}" + [[ ! -e "${dist_path}/${f}" ]] && debug " Copy: ${base_path}/${f} to ${dist_path}" && cp "${base_path}/${f}" "${dist_path}" fi shift done diff --git a/customer/usr/local/bin/entry.sh b/customer/usr/local/bin/entry.sh index e613cd6..aae650a 100755 --- a/customer/usr/local/bin/entry.sh +++ b/customer/usr/local/bin/entry.sh @@ -11,7 +11,7 @@ set -euo pipefail . /usr/local/bin/environment.sh # 设置环境变量 -LOG_I "** Processing entry.sh **" +info "** Processing entry.sh **" # 优先处理'-'开始的版本信息、帮助信息显示命令,如果是该类命令,处理后退出容器 [[ "${1:0:1}" == '-' ]] && set -- "${APP_EXEC:-/bin/bash}" "$@" && print_command_help "$@" @@ -26,5 +26,5 @@ if [[ "$(id -u)" == '0' ]] && [[ "$1" == "run.sh" ]]; then fi # 处理非以上情形的自定义命令 -LOG_I "Start container with command: $@" +info "Start container with command: $@" exec "$@" diff --git a/customer/usr/local/bin/run.sh b/customer/usr/local/bin/run.sh index 22e237f..8694064 100755 --- a/customer/usr/local/bin/run.sh +++ b/customer/usr/local/bin/run.sh @@ -11,7 +11,7 @@ set -euo pipefail . /usr/local/bin/environment.sh # 设置环境变量 -LOG_I "** Processing run.sh **" +info "** Processing run.sh **" readonly START_COMMAND="$(command -v ${APP_EXEC:-${APP_NAME}})" # 配置默认启动参数(应用配置文件、前台方式启动) @@ -20,5 +20,5 @@ flags=() [[ -n "${APP_EXTRA_FLAGS:-}" ]] && flags+=("${APP_EXTRA_FLAGS[@]}") flags+=("$@") -LOG_I "Start ${APP_NAME} with command: ${START_COMMAND[@]} ${flags[@]}" +info "Start ${APP_NAME} with command: ${START_COMMAND[@]} ${flags[@]}" exec "${START_COMMAND[@]}" "${flags[@]}" diff --git a/customer/usr/local/bin/setup.sh b/customer/usr/local/bin/setup.sh index 7f45b80..597a057 100755 --- a/customer/usr/local/bin/setup.sh +++ b/customer/usr/local/bin/setup.sh @@ -14,22 +14,22 @@ set -euo pipefail . /usr/local/bin/environment.sh # 设置环境变量 . /usr/local/bin/common.sh # 应用专用函数库 -LOG_I "** Processing setup.sh **" +info "** Processing setup.sh **" APP_DIRS=(/var/log/${APP_NAME} /var/run/${APP_NAME} /var/cache/${APP_NAME} ${APP_HOME}) APP_DIRS+=(${APP_HOME}/conf ${APP_HOME}/data ${APP_HOME}/cert ${APP_HOME}/log) -LOG_I "Ensure directory exists: ${APP_DIRS[@]}" +info "Ensure directory exists: ${APP_DIRS[@]}" for dir in ${APP_DIRS[@]}; do ensure_dir_exists ${dir} done # 检测指定文件是否在配置文件存储目录存在,如果不存在则拷贝(新挂载数据卷、手动删除都会导致不存在) -LOG_I "Check config files in: ${APP_CONF_DIR}" +info "Check config files in: ${APP_CONF_DIR}" if [[ -z "$(ls -A "${APP_CONF_DIR}")" ]]; then app_ensure_config_file_exist "${APP_CONF_DIR}" "${APP_DEF_DIR}" $(ls -A "${APP_DEF_DIR}") fi # 解决使用non-root后,[emerg] open() "/dev/stdout" failed (13: Permission denied) -LOG_D "Change permissions of stdout/stderr to 0662" +debug "Change permissions of stdout/stderr to 0662" chmod 0662 /dev/stdout /dev/stderr