diff --git a/scripts/build_all_service.sh b/scripts/build_all_service.sh index 40f6bb618..a424ac7b1 100755 --- a/scripts/build_all_service.sh +++ b/scripts/build_all_service.sh @@ -41,19 +41,10 @@ echo -e "${BOLD_PREFIX}_________________________________________________________ bin_dir="$BIN_DIR" logs_dir="$OPENIM_ROOT/logs" -sdk_db_dir="$OPENIM_ROOT/db/sdk/" echo "==> bin_dir=$bin_dir" echo "==> logs_dir=$logs_dir" -echo "==> sdk_db_dir=$sdk_db_dir" -# Automatically created when there is no bin, logs folder -if [ ! -d $logs_dir ]; then - mkdir -p $logs_dir -fi -if [ ! -d $sdk_db_dir ]; then - mkdir -p $sdk_db_dir -fi cd $SCRIPTS_ROOT/.. diff --git a/scripts/check_all.sh b/scripts/check_all.sh index 796a1ef12..7e3f9d616 100755 --- a/scripts/check_all.sh +++ b/scripts/check_all.sh @@ -37,7 +37,7 @@ for i in ${service_port_name[*]}; do list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}') list_to_string $list for j in ${ports_array}; do - port=$(ss -tunlp| grep -E 'api|rpc|openIm' | awk '{print $5}' | grep -w ${j} | awk -F '[:]' '{print $NF}') + port=$(ss -tunlp| grep -E 'api|rpc|open_im' | awk '{print $5}' | grep -w ${j} | awk -F '[:]' '{print $NF}') if [[ ${port} -ne ${j} ]]; then echo -e ${YELLOW_PREFIX}${i}${COLOR_SUFFIX}${RED_PREFIX}" service does not start normally,not initiated port is "${COLOR_SUFFIX}${YELLOW_PREFIX}${j}${COLOR_SUFFIX} echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX} diff --git a/scripts/start_all.sh b/scripts/start_all.sh index c8b1da294..2ea4c3def 100755 --- a/scripts/start_all.sh +++ b/scripts/start_all.sh @@ -37,11 +37,9 @@ echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}" bin_dir="$BIN_DIR" logs_dir="$SCRIPTS_ROOT/../logs" -sdk_db_dir="$SCRIPTS_ROOT/../sdk/db/" echo -e "${YELLOW_PREFIX}=======>bin_dir=$bin_dir${COLOR_SUFFIX}" echo -e "${YELLOW_PREFIX}=======>logs_dir=$logs_dir${COLOR_SUFFIX}" -echo -e "${YELLOW_PREFIX}=======>sdk_db_dir=$sdk_db_dir${COLOR_SUFFIX}" #service filename service_filename=( @@ -65,6 +63,10 @@ service_prometheus_port_name=( ) +# Automatically created when there is no bin, logs folder +if [ ! -d $logs_dir ]; then + mkdir -p $logs_dir +fi cd $SCRIPTS_ROOT for ((i = 0; i < ${#service_filename[*]}; i++)); do diff --git a/scripts/stop_all.sh b/scripts/stop_all.sh index fbde89fa6..6e69ba53f 100755 --- a/scripts/stop_all.sh +++ b/scripts/stop_all.sh @@ -16,22 +16,32 @@ #fixme This scripts is to stop the service SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +OPENIM_ROOT=$(cd $(dirname "${BASH_SOURCE[0]}")/.. &&pwd) source $OPENIM_ROOT/scripts/style_info.sh source $OPENIM_ROOT/scripts/path_info.sh +source $SCRIPTS_ROOT/function.sh -cd "$SCRIPTS_ROOT" +service_port_name=( + openImChatApiPort + openImAdminApiPort + #api port name + openImAdminPort + openImChatPort +) -for i in ${service_names[*]}; do - #Check whether the service exists - name="ps -aux |grep -w $i |grep -v grep" - count="${name}| wc -l" - if [ $(eval ${count}) -gt 0 ]; then - pid="${name}| awk '{print \$2}'" - echo -e "${SKY_BLUE_PREFIX}Killing service:$i pid:$(eval $pid)${COLOR_SUFFIX}" - #kill the service that existed - kill -9 $(eval $pid) - echo -e "${SKY_BLUE_PREFIX}service:$i was killed ${COLOR_SUFFIX}" - fi +for i in ${service_port_name[*]}; do + list=$(cat $OPENIM_ROOT/config/config.yaml | grep -w ${i} | awk -F '[:]' '{print $NF}') + list_to_string $list + for j in ${ports_array}; do + name="ps -aux |grep -w $j |grep -v grep" + count="${name}| wc -l" + if [ $(eval ${count}) -gt 0 ]; then + pid="${name}| awk '{print \$2}'" + echo -e "${SKY_BLUE_PREFIX}Killing service:$i pid:$(eval $pid)${COLOR_SUFFIX}" + #kill the service that existed + kill -9 $(eval $pid) + echo -e "${SKY_BLUE_PREFIX}service:$i was killed ${COLOR_SUFFIX}" + fi + done done \ No newline at end of file