Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>pull/462/head
parent
f7bd391ed7
commit
d6a89567e5
@ -1,60 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
#Include shell font styles and some basic information
|
|
||||||
source ./style_info.cfg
|
|
||||||
source ./path_info.cfg
|
|
||||||
source ./function.sh
|
|
||||||
ulimit -n 200000
|
|
||||||
|
|
||||||
ws_address=$(cat $config_path | grep openImWsAddress | awk -F '[ ]' '{print $NF}')
|
|
||||||
api_address=$(cat $config_path | grep openImApiAddress | awk -F '[ ]' '{print $NF}')
|
|
||||||
list3=$(cat $config_path | grep openImSdkWsPort | awk -F '[:]' '{print $NF}')
|
|
||||||
logLevel=$(cat $config_path | grep remainLogLevel | awk -F '[:]' '{print $NF}')
|
|
||||||
list_to_string $list3
|
|
||||||
sdkws_ports=($ports_array)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Check if the service exists
|
|
||||||
#If it is exists,kill this process
|
|
||||||
check=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | wc -l)
|
|
||||||
if [ $check -ge 1 ]; then
|
|
||||||
oldPid=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | awk '{print $2}')
|
|
||||||
kill -9 ${oldPid}
|
|
||||||
fi
|
|
||||||
#Waiting port recycling
|
|
||||||
sleep 1
|
|
||||||
cd ${sdk_server_binary_root}
|
|
||||||
echo "==========================start js sdk server===========================">>../logs/openIM.log
|
|
||||||
nohup ./${sdk_server_name} -openIM_ws_address ${ws_address} -sdk_ws_port ${sdkws_ports[0]} -openIM_api_address ${api_address} -openIM_log_level ${logLevel} >>../logs/openIM.log 2>&1 &
|
|
||||||
|
|
||||||
#Check launched service process
|
|
||||||
sleep 3
|
|
||||||
check=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | wc -l)
|
|
||||||
allPorts=""
|
|
||||||
if [ $check -ge 1 ]; then
|
|
||||||
allNewPid=$(ps aux | grep -w ./${sdk_server_name} | grep -v grep | awk '{print $2}')
|
|
||||||
for i in $allNewPid; do
|
|
||||||
ports=$(netstat -netulp | grep -w ${i} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
|
||||||
allPorts=${allPorts}"$ports "
|
|
||||||
done
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${sdk_server_name}${COLOR_SUFFIX}
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allNewPid}${COLOR_SUFFIX}
|
|
||||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
|
||||||
else
|
|
||||||
echo -e ${YELLOW_PREFIX}${sdk_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
|
||||||
fi
|
|
@ -1,9 +1,44 @@
|
|||||||
#Shell font formatting information
|
COLOR_SUFFIX="\033[0m" # End all colors and special effects
|
||||||
COLOR_SUFFIX="\033[0m"
|
|
||||||
BLACK_PREFIX="\033[30m"
|
BLACK_PREFIX="\033[30m" # Black prefix
|
||||||
RED_PREFIX="\033[31m"
|
RED_PREFIX="\033[31m" # Red prefix
|
||||||
GREEN_PREFIX="\033[32m"
|
GREEN_PREFIX="\033[32m" # Green prefix
|
||||||
YELLOW_PREFIX="\033[33m"
|
YELLOW_PREFIX="\033[33m" # Yellow prefix
|
||||||
BLUE_PREFIX="\033[34m"
|
BLUE_PREFIX="\033[34m" # Blue prefix
|
||||||
PURPLE_PREFIX="\033[35m"
|
PURPLE_PREFIX="\033[35m" # Purple prefix
|
||||||
SKY_BLUE_PREFIX="\033[36m"
|
SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix
|
||||||
|
WHITE_PREFIX="\033[37m" # White prefix
|
||||||
|
BOLD_PREFIX="\033[1m" # Bold prefix
|
||||||
|
UNDERLINE_PREFIX="\033[4m" # Underline prefix
|
||||||
|
ITALIC_PREFIX="\033[3m" # Italic prefix
|
||||||
|
|
||||||
|
BACKGROUND_BLACK="\033[40m" # Black background
|
||||||
|
BACKGROUND_RED="\033[41m" # Red background
|
||||||
|
BACKGROUND_GREEN="\033[42m" # Green background
|
||||||
|
BACKGROUND_YELLOW="\033[43m" # Yellow background
|
||||||
|
BACKGROUND_BLUE="\033[44m" # Blue background
|
||||||
|
BACKGROUND_PURPLE="\033[45m" # Purple background
|
||||||
|
BACKGROUND_SKY_BLUE="\033[46m" # Sky blue background
|
||||||
|
BACKGROUND_WHITE="\033[47m" # White background
|
||||||
|
|
||||||
|
BLINK="\033[5m" # Blinking effect
|
||||||
|
INVERT="\033[7m" # Invert color
|
||||||
|
HIDE="\033[8m" # Hide text
|
||||||
|
|
||||||
|
GRAY_PREFIX="\033[90m" # Gray prefix
|
||||||
|
LIGHT_RED_PREFIX="\033[91m" # Light red prefix
|
||||||
|
LIGHT_GREEN_PREFIX="\033[92m" # Light green prefix
|
||||||
|
LIGHT_YELLOW_PREFIX="\033[93m" # Light yellow prefix
|
||||||
|
LIGHT_BLUE_PREFIX="\033[94m" # Light blue prefix
|
||||||
|
LIGHT_PURPLE_PREFIX="\033[95m" # Light purple prefix
|
||||||
|
LIGHT_SKY_BLUE_PREFIX="\033[96m" # Light sky blue prefix
|
||||||
|
LIGHT_WHITE_PREFIX="\033[97m" # Light white prefix
|
||||||
|
|
||||||
|
BACKGROUND_GRAY="\033[100m" # Gray background
|
||||||
|
BACKGROUND_LIGHT_RED="\033[101m" # Light red background
|
||||||
|
BACKGROUND_LIGHT_GREEN="\033[102m" # Light green background
|
||||||
|
BACKGROUND_LIGHT_YELLOW="\033[103m" # Light yellow background
|
||||||
|
BACKGROUND_LIGHT_BLUE="\033[104m" # Light blue background
|
||||||
|
BACKGROUND_LIGHT_PURPLE="\033[105m" # Light purple background
|
||||||
|
BACKGROUND_LIGHT_SKY_BLUE="\033[106m" # Light sky blue background
|
||||||
|
BACKGROUND_LIGHT_WHITE="\033[107m" # Light white background
|
||||||
|
Loading…
Reference in new issue