Skip to content

Commit

Permalink
fix_docker
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyekanren committed Jan 26, 2025
1 parent 9c9b239 commit 748e912
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
5 changes: 1 addition & 4 deletions docker/src/main/DockerCompose/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 17 additions & 16 deletions docker/src/main/DockerCompose/replace-conf-from-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 748e912

Please sign in to comment.