diff --git a/docker/src/main/DockerCompose/entrypoint.sh b/docker/src/main/DockerCompose/entrypoint.sh index 72beea010eeb..68df9db78b77 100755 --- a/docker/src/main/DockerCompose/entrypoint.sh +++ b/docker/src/main/DockerCompose/entrypoint.sh @@ -26,11 +26,8 @@ function on_stop(){ if [[ "$start_what" != "confignode" ]]; then echo "###### manually flush ######"; start-cli.sh -e "flush;" || true - stop-datanode.sh - echo "##### done ######"; - else - stop-confignode.sh; fi + stop-standalone.sh } trap 'on_stop' SIGTERM SIGKILL SIGQUIT diff --git a/docker/src/main/DockerCompose/replace-conf-from-env.sh b/docker/src/main/DockerCompose/replace-conf-from-env.sh index dc3d6cf2cf11..eb183033119c 100755 --- a/docker/src/main/DockerCompose/replace-conf-from-env.sh +++ b/docker/src/main/DockerCompose/replace-conf-from-env.sh @@ -21,36 +21,37 @@ conf_path=${IOTDB_HOME}/conf target_files="iotdb-system.properties" -function process_single() { - local key_value="$1" - local filename=$2 - local key=$(echo $key_value | cut -d = -f1) - local line=$(grep -ni "${key}=" ${filename}) - #echo "line=$line" - if [[ -n "${line}" ]]; then +function process_single(){ + local key_value="$1" + local filename=$2 + local key=$(echo $key_value|cut -d = -f1) + local line=$(grep -ni "${key}=" ${filename}) + #echo "line=$line" + if [[ -n "${line}" ]]; then echo "update $key $filename" - local line_no=$(echo $line | cut -d : -f1) - local content=$(echo $line | cut -d : -f2) + local line_no=$(echo $line|cut -d : -f1) + local content=$(echo $line|cut -d : -f2) if [[ "${content:0:1}" != "#" ]]; then sed -i "${line_no}d" ${filename} fi sed -i "${line_no} i${key_value}" ${filename} else - echo "append $key to $filename" - - echo "${key_value}" >>"${filename}" - fi + echo "append $key $filename" + line_no=$(wc -l $filename) + sed -i "${line_no} a${key_value}" ${filename} + fi } -function replace_configs() { +function replace_configs(){ for v in $(env); do if [[ "${v}" =~ "=" && "${v}" =~ "_" && ! "${v}" =~ "JAVA_" ]]; then - # echo "###### $v ####" +# echo "###### $v ####" for f in ${target_files}; do - process_single $v ${conf_path}/$f + process_single $v ${conf_path}/$f done fi done } replace_configs +