shell update

This commit is contained in:
Gordon 2021-09-13 21:25:06 +08:00
parent 90e626c261
commit 0d04955bdd
3 changed files with 35 additions and 3 deletions

32
script/check_all.sh Normal file
View File

@ -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}

View File

@ -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

View File

@ -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