From 1b5eb4a5c0dd075a3d80d445028c1665fe6006ba Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <86140903+cubxxw@users.noreply.github.com> Date: Wed, 12 Jul 2023 19:21:55 +0800 Subject: [PATCH] feat: add scripts (#514) --- Dockerfile | 2 +- scripts/build_all_service.sh | 7 +++++-- scripts/msg_transfer_start.sh | 3 +++ scripts/path_info.sh | 3 --- scripts/start_rpc_service.sh | 3 --- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5df672921..579c0c1d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/scripts #Copy scripts files and binary files to the blank image COPY --from=build /Open-IM-Server/scripts /Open-IM-Server/scripts -COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64 +COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64 WORKDIR /Open-IM-Server/scripts diff --git a/scripts/build_all_service.sh b/scripts/build_all_service.sh index 5d8592eca..7cb290ea6 100755 --- a/scripts/build_all_service.sh +++ b/scripts/build_all_service.sh @@ -26,8 +26,6 @@ echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}" echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}" echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}" -cd $SCRIPTS_ROOT - echo -e "" echo -e "${BACKGROUND_BLUE}===============> Building all using make build binary files ${COLOR_SUFFIX}" @@ -65,6 +63,11 @@ cd $OPENIM_ROOT # Execute 'make build' make build +if [ $? -ne 0 ]; then + echo "make build Error, script exits" + exit 1 +fi + # Get the current operating system and architecture OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) diff --git a/scripts/msg_transfer_start.sh b/scripts/msg_transfer_start.sh index e2034388b..a4dcf1fe7 100755 --- a/scripts/msg_transfer_start.sh +++ b/scripts/msg_transfer_start.sh @@ -24,6 +24,9 @@ source $SCRIPTS_ROOT/function.sh cd $SCRIPTS_ROOT +chmod +x build_all_service.sh +./build_all_service.sh + echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}" echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}" echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}" diff --git a/scripts/path_info.sh b/scripts/path_info.sh index bff87ed83..5d2832efc 100755 --- a/scripts/path_info.sh +++ b/scripts/path_info.sh @@ -79,13 +79,10 @@ cmd_utils_name="openim-cmdutils" cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR" cmd_utils_source_root="$OPENIM_ROOT/cmd/openim-cmdutils/" -echo "debug========> config_path=$config_path" # Global configuration file default dir config_path="$OPENIM_ROOT/config/config.yaml" configfile_path="$OPENIM_ROOT/config" -echo "BUG: debug========> config_path=$config_path" - # servicefile dir path service_source_root=( # api service file diff --git a/scripts/start_rpc_service.sh b/scripts/start_rpc_service.sh index cafbb254e..436ffc690 100755 --- a/scripts/start_rpc_service.sh +++ b/scripts/start_rpc_service.sh @@ -95,7 +95,6 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do portList2=$(cat $config_path | grep ${service_prometheus_port_name[$i]} | awk -F '[:]' '{print $NF}') list_to_string $portList2 - echo -e "debug========>cmd=$cmd AAAAA" prome_ports=($ports_array) #Start related rpc services based on the number of ports for ((j = 0; j < ${#service_ports[*]}; j++)); do @@ -109,10 +108,8 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do cmd="./${service_filename[$i]} --port ${service_ports[$j]}" fi echo $cmd - echo -e "debug========>cmd=$cmd" echo "=====================start ${service_filename[$i]}======================">>$OPENIM_ROOT/logs/openIM.log nohup $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & - echo -e "debug========>OpenIMROOT=$OPENIM_ROOT" sleep 1 pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1" echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:${service_ports[$j]} pid:$(eval $pid)$COLOR_SUFFIX"