mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 21:22:16 +08:00
script update
This commit is contained in:
parent
80e7c44cf5
commit
1d4b47f5e6
@ -14,8 +14,15 @@ service_port_name=(
|
|||||||
openImPushPort
|
openImPushPort
|
||||||
openImWsPort
|
openImWsPort
|
||||||
openImSdkWsPort
|
openImSdkWsPort
|
||||||
|
openImDemoPort
|
||||||
)
|
)
|
||||||
|
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
|
||||||
for i in ${service_port_name[*]}; do
|
for i in ${service_port_name[*]}; do
|
||||||
|
if [ ${switch} != "true" ]; then
|
||||||
|
if [ ${i} == "openImDemoPort"]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
||||||
list_to_string $list
|
list_to_string $list
|
||||||
for j in ${ports_array}; do
|
for j in ${ports_array}; do
|
||||||
|
|||||||
47
script/demo_svr_start.sh
Normal file
47
script/demo_svr_start.sh
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#Include shell font styles and some basic information
|
||||||
|
source ./style_info.cfg
|
||||||
|
source ./path_info.cfg
|
||||||
|
source ./function.sh
|
||||||
|
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
|
||||||
|
if [ ${switch} != "true" ]; then
|
||||||
|
echo -e ${YELLOW_PREFIX}" demo service switch is false not start demo "${COLOR_SUFFIX}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
list1=$(cat $config_path | grep openImDemoPort | awk -F '[:]' '{print $NF}')
|
||||||
|
list_to_string $list1
|
||||||
|
api_ports=($ports_array)
|
||||||
|
|
||||||
|
#Check if the service exists
|
||||||
|
#If it is exists,kill this process
|
||||||
|
check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l)
|
||||||
|
if [ $check -ge 1 ]; then
|
||||||
|
oldPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}')
|
||||||
|
kill -9 $oldPid
|
||||||
|
fi
|
||||||
|
#Waiting port recycling
|
||||||
|
sleep 1
|
||||||
|
cd ${demo_server_binary_root}
|
||||||
|
|
||||||
|
for ((i = 0; i < ${#api_ports[@]}; i++)); do
|
||||||
|
nohup ./${demo_server_name} -port ${api_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
#Check launched service process
|
||||||
|
check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l)
|
||||||
|
if [ $check -ge 1 ]; then
|
||||||
|
newPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}')
|
||||||
|
ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
||||||
|
allPorts=""
|
||||||
|
|
||||||
|
for i in $ports; do
|
||||||
|
allPorts=${allPorts}"$i "
|
||||||
|
done
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||||
|
else
|
||||||
|
echo -e ${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
||||||
|
fi
|
||||||
@ -27,6 +27,10 @@ sdk_server_name="open_im_sdk_server"
|
|||||||
sdk_server_binary_root="../bin/"
|
sdk_server_binary_root="../bin/"
|
||||||
sdk_server_source_root="../cmd/Open-IM-SDK-Core/"
|
sdk_server_source_root="../cmd/Open-IM-SDK-Core/"
|
||||||
|
|
||||||
|
demo_server_name="open_im_demo"
|
||||||
|
demo_server_binary_root="../bin/"
|
||||||
|
demo_server_source_root="../cmd/open_im_demo/"
|
||||||
|
|
||||||
|
|
||||||
#Global configuration file default dir
|
#Global configuration file default dir
|
||||||
config_path="../config/config.yaml"
|
config_path="../config/config.yaml"
|
||||||
@ -46,6 +50,7 @@ service_source_root=(
|
|||||||
${push_source_root}
|
${push_source_root}
|
||||||
${sdk_server_source_root}
|
${sdk_server_source_root}
|
||||||
${timer_task_source_root}
|
${timer_task_source_root}
|
||||||
|
${demo_server_source_root}
|
||||||
)
|
)
|
||||||
#service filename
|
#service filename
|
||||||
service_names=(
|
service_names=(
|
||||||
@ -62,6 +67,7 @@ service_names=(
|
|||||||
${push_name}
|
${push_name}
|
||||||
${sdk_server_name}
|
${sdk_server_name}
|
||||||
${timer_task_name}
|
${timer_task_name}
|
||||||
|
${demo_server_name}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ need_to_start_server_shell=(
|
|||||||
msg_transfer_start.sh
|
msg_transfer_start.sh
|
||||||
sdk_svr_start.sh
|
sdk_svr_start.sh
|
||||||
timer_start.sh
|
timer_start.sh
|
||||||
|
demo_svr_start.sh
|
||||||
)
|
)
|
||||||
|
|
||||||
for i in ${need_to_start_server_shell[*]}; do
|
for i in ${need_to_start_server_shell[*]}; do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user