shell update

This commit is contained in:
Gordon 2021-11-10 19:11:49 +08:00
parent b729cac998
commit 34e8961601
8 changed files with 55 additions and 2 deletions

View File

@ -1,6 +1,6 @@
.PHONY: all build run gotool install clean help
BINARY_NAME=open_im_timed_task
BINARY_NAME=open_im_timer_task
BIN_DIR=../../bin/
all: gotool build

View File

@ -8,6 +8,7 @@ import (
)
func main() {
log.NewPrivateLog("timer")
//for {
// fmt.Println("start delete mongodb expired record")
// timeUnixBegin := time.Now().Unix()

View File

@ -40,4 +40,14 @@ else
exit -1
fi
check=$(ps aux | grep -w ./${timer_task_name} | grep -v grep | wc -l)
if [ $check -ge 1 ]; then
echo -e ${GREEN_PREFIX}"none port has been starting,belongs service is openImMsgTimer"${COLOR_SUFFIX}
else
echo -e ${RED_PREFIX}"openImMsgTimer service does not start normally"${COLOR_SUFFIX}
echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
exit -1
fi
echo -e ${YELLOW_PREFIX}"all services launch success"${COLOR_SUFFIX}

View File

@ -9,6 +9,7 @@ need_to_start_server_shell=(
push_start.sh
msg_transfer_start.sh
sdk_svr_start.sh
timer_start.sh
)
#fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started

View File

@ -19,6 +19,10 @@ msg_transfer_source_root="../cmd/open_im_msg_transfer/"
msg_transfer_service_num=2
timer_task_name="open_im_timer_task"
timer_task_binary_root="../bin/"
timer_task_source_root="../cmd/open_im_timer_task/"
sdk_server_name="open_im_sdk_server"
sdk_server_binary_root="../bin/"
sdk_server_source_root="../cmd/Open-IM-SDK-Core/"
@ -41,6 +45,7 @@ service_source_root=(
${msg_source_root}
${push_source_root}
${sdk_server_source_root}
${timer_task_source_root}
)
#service filename
service_names=(
@ -56,6 +61,7 @@ service_names=(
${msg_name}
${push_name}
${sdk_server_name}
${timer_task_name}
)

View File

@ -9,6 +9,7 @@ need_to_start_server_shell=(
push_start.sh
msg_transfer_start.sh
sdk_svr_start.sh
timer_start.sh
)
for i in ${need_to_start_server_shell[*]}; do

View File

@ -26,7 +26,6 @@ service_port_name=(
openImGroupPort
openImAuthPort
openImOfflineMessagePort
)
for ((i = 0; i < ${#service_filename[*]}; i++)); do

35
script/timer_start.sh Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
#Include shell font styles and some basic information
source ./style_info.cfg
source ./path_info.cfg
#Check if the service exists
#If it is exists,kill this process
check=`ps aux | grep -w ./${timer_task_name} | grep -v grep| wc -l`
if [ $check -ge 1 ]
then
oldPid=`ps aux | grep -w ./${timer_task_name} | grep -v grep|awk '{print $2}'`
kill -9 $oldPid
fi
#Waiting port recycling
sleep 1
cd ${timer_task_binary_root}
nohup ./${timer_task_name} >>../logs/openIM.log 2>&1 &
#Check launched service process
check=`ps aux | grep -w ./${timer_task_name} | grep -v grep| wc -l`
if [ $check -ge 1 ]
then
newPid=`ps aux | grep -w ./${timer_task_name} | grep -v grep|awk '{print $2}'`
allPorts=""
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${timer_task_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}${timer_task_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX}
fi