2023-06-30 23:22:58 +08:00
#!/usr/bin/env bash
2023-08-08 11:24:15 +08:00
2023-07-04 11:15:20 +08:00
# 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.
2023-06-30 23:22:58 +08:00
#fixme This scripts is the total startup scripts
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
2023-07-11 21:13:06 +08:00
#Include shell font styles and some basic information
SCRIPTS_ROOT = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
OPENIM_ROOT = $( dirname " ${ BASH_SOURCE [0] } " ) /..
2023-06-30 23:22:58 +08:00
#fixme Put the shell scripts name here
need_to_start_server_shell = (
2023-08-04 19:13:22 +08:00
${ SCRIPTS_ROOT } /start_rpc_service.sh
${ SCRIPTS_ROOT } /msg_gateway_start.sh
${ SCRIPTS_ROOT } /push_start.sh
${ SCRIPTS_ROOT } /msg_transfer_start.sh
${ SCRIPTS_ROOT } /start_cron.sh
2023-06-30 23:22:58 +08:00
)
2023-08-11 14:41:40 +08:00
component_check = start_component_check.sh
chmod +x $SCRIPTS_ROOT /$component_check
$SCRIPTS_ROOT /$component_check
if [ $? -ne 0 ] ; then
# Print error message and exit
echo " ${ BOLD_PREFIX } ${ RED_PREFIX } Error executing ${ component_check } . Exiting... ${ COLOR_SUFFIX } "
exit -1
fi
2023-06-30 23:22:58 +08:00
#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
sleep 10
time = ` date +"%Y-%m-%d %H:%M:%S" `
2023-07-09 16:51:43 +08:00
echo "==========================================================" >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
echo "==========================================================" >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
echo "==========================================================" >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
echo " ==========server start time: ${ time } =========== " >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
echo "==========================================================" >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
echo "==========================================================" >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
echo "==========================================================" >>$OPENIM_ROOT /logs/openIM.log 2>& 1 &
2023-06-30 23:22:58 +08:00
for i in ${ need_to_start_server_shell [*] } ; do
2023-08-04 19:13:22 +08:00
$i
2023-06-30 23:22:58 +08:00
done
sleep 15
#fixme prevents the openIM service exit after execution in the docker container
tail -f /dev/null
2023-08-11 15:13:37 +08:00
# nohup ./bin/seata-server.sh > ./logs/seata.log.out 2>&1 &
# # seata注册到nacos的ip和端口,不配置默认获取本机ip(docker容器ip)
# echo $SEATA_IP $SEATA_PORT
# tail -f logs/seata.log.out