From afc4e23f65bae4f3b939c72ba3e7aac78b7d96ac Mon Sep 17 00:00:00 2001 From: hanzhixiao <709674996@qq.com> Date: Wed, 9 Aug 2023 14:12:32 +0800 Subject: [PATCH] 815 Signed-off-by: hanzhixiao <709674996@qq.com> --- scripts/start_all.sh | 3 ++- scripts/start_component_check.sh | 4 ++++ tools/component/main.go | 8 +++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/start_all.sh b/scripts/start_all.sh index 3b526006a..fb59d6767 100755 --- a/scripts/start_all.sh +++ b/scripts/start_all.sh @@ -70,13 +70,14 @@ cd $SCRIPTS_ROOT # FIXME Put the shell script names here need_to_start_server_shell=( - start_component_check.sh start_rpc_service.sh push_start.sh msg_transfer_start.sh msg_gateway_start.sh start_cron.sh ) + chmod +x $i + start_component_check.sh # Loop through the script names and execute them for i in ${need_to_start_server_shell[*]}; do diff --git a/scripts/start_component_check.sh b/scripts/start_component_check.sh index f0358c6f9..18726ce87 100644 --- a/scripts/start_component_check.sh +++ b/scripts/start_component_check.sh @@ -35,4 +35,8 @@ cmd="./${component_check}" echo "==========================start components checking===========================">>$OPENIM_ROOT/logs/openIM.log $cmd +if [ $? -eq 0 ]; then + exit 1 +fi + diff --git a/tools/component/main.go b/tools/component/main.go index 3bd0b2420..ebc70913d 100644 --- a/tools/component/main.go +++ b/tools/component/main.go @@ -28,7 +28,7 @@ import ( const ( cfgPath = "../../../../../config/config.yaml" minioHealthCheckDuration = 1 - maxRetry = 10000 + maxRetry = 100 componentStartErrCode = 6000 configErrCode = 6001 ) @@ -78,6 +78,7 @@ func main() { // Check Minio if err := checkMinio(); err != nil { if index := strings.Index(err.Error(), utils.IntToString(configErrCode)); index != -1 { + successPrint(fmt.Sprint("Minio starts successfully")) warningPrint(fmt.Sprintf("%v. Please modify your config file", err.Error())) } else { errorPrint(fmt.Sprintf("Starting Minio failed: %v. Please make sure your Minio service has started", err.Error())) @@ -110,8 +111,9 @@ func main() { successPrint(fmt.Sprint("Kafka starts successfully")) } successPrint(fmt.Sprint("All components starts successfully")) - break + os.Exit(0) } + os.Exit(1) } func exactIP(urll string) string { @@ -275,5 +277,5 @@ func successPrint(s string) { } func warningPrint(s string) { - fmt.Printf("\x1b[%dmWarning: %v\x1b[0m\n", 33, s) + fmt.Printf("\x1b[%dmWarning: But %v\x1b[0m\n", 33, s) }