diff --git a/script/check_all.sh b/script/check_all.sh new file mode 100644 index 000000000..05873dcd5 --- /dev/null +++ b/script/check_all.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +source ./style_info.cfg +source ./path_info.cfg +source ./function.sh +service_port_name=( + #api port name + openImApiPort + #rpc port name + openImUserPort + openImFriendPort + openImOfflineMessagePort + openImOnlineRelayPort + openImGroupPort + openImAuthPort + openImPushPort + websocketPort +) + 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=`netstat -netulp |grep ./open_im| awk '{print $4}'|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} + exit 1 + else + echo -e ${j}${GREEN_PREFIX}" port has been listening,belongs service is "${i}${COLOR_SUFFIX} + fi + done + done + echo -e ${YELLOW_PREFIX}"all service launch success"${COLOR_SUFFIX} diff --git a/script/msg_gateway_start.sh b/script/msg_gateway_start.sh index 2f9c60215..bcd928c53 100644 --- a/script/msg_gateway_start.sh +++ b/script/msg_gateway_start.sh @@ -23,14 +23,14 @@ if [ $check -ge 1 ]; then kill -9 ${oldPid} fi #Waiting port recycling -sleep 3 +sleep 1 cd ${msg_gateway_binary_root} for ((i = 0; i < ${#ws_ports[@]}; i++)); do nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} >>../logs/${msg_gateway_name}.log 2>&1 & done #Check launched service process -sleep 1 +sleep 3 check=$(ps aux | grep -w ./${msg_gateway_name} | grep -v grep | wc -l) allPorts="" if [ $check -ge 1 ]; then diff --git a/script/push_start.sh b/script/push_start.sh index 5dc8546a7..f294ff6d1 100644 --- a/script/push_start.sh +++ b/script/push_start.sh @@ -25,7 +25,7 @@ for ((i = 0; i < ${#rpc_ports[@]}; i++)); do nohup ./${push_name} -port ${rpc_ports[$i]} >>../logs/${push_name}.log 2>&1 & done -sleep 1 +sleep 3 #Check launched service process check=$(ps aux | grep -w ./${push_name} | grep -v grep | wc -l) if [ $check -eq 1 ]; then