check script

pull/455/head
wangchuxiao 2 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 43eb2326d1
commit d53d35c831

@ -7,5 +7,6 @@ sleep 30
echo "check OpenIM................................"
./check_all.sh
chmod +x ./enterprise/*.sh
./enterprise/check_all.sh

@ -0,0 +1,28 @@
#!/usr/bin/env bash
source ./style_info.cfg
source ./enterprise/path_info.cfg
source ./enterprise/function.sh
service_port_name=(
openImChatApiPort
openImAdminApiPort
#api port name
openImAdminPort
openImChatPort
)
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
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 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}
exit -1
else
echo -e ${j}${GREEN_PREFIX}" port has been listening,belongs service is "${i}${COLOR_SUFFIX}
fi
done
done

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#input:[10023,2323,3434]
#output:10023 2323 3434
list_to_string(){
ports_list=$*
sub_s1=`echo $ports_list | sed 's/ //g'`
sub_s2=${sub_s1//,/ }
sub_s3=${sub_s2#*[}
sub_s4=${sub_s3%]*}
ports_array=$sub_s4
}
remove_space(){
value=$*
result=`echo $value | sed 's/ //g'`
}

@ -0,0 +1,29 @@
#Don't put the space between "="
demo_server_name="open_im_chat_api"
demo_server_binary_root="../bin/"
#Global configuration file default dir
config_path="../docker-compose_cfg/config.yaml"
#servicefile dir path
service_source_root=(
#api service file
../cmd/api/chat/
../cmd/api/admin/
#rpc service file
../cmd/rpc/admin/
../cmd/rpc/chat/
)
#service filename
service_names=(
#api service filename
open_im_chat_api
open_im_admin_api
#rpc service filename
open_im_admin
open_im_chat
)
Loading…
Cancel
Save