From 1b914896a98c51999ff57e66d7b874773e52abef Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong (cubxxw)" <3293172751nss@gmail.com> Date: Fri, 2 Feb 2024 21:11:29 +0800 Subject: [PATCH] fix: fix this bug scripts --- pkg/common/startrpc/start.go | 5 +++-- scripts/install/openim-crontask.sh | 1 + scripts/install/openim-rpc.sh | 1 + scripts/lib/util.sh | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/common/startrpc/start.go b/pkg/common/startrpc/start.go index 31fe4fdd5..b2b846e94 100644 --- a/pkg/common/startrpc/start.go +++ b/pkg/common/startrpc/start.go @@ -17,7 +17,6 @@ package startrpc import ( "errors" "fmt" - "github.com/OpenIMSDK/tools/errs" "log" "net" "net/http" @@ -28,6 +27,8 @@ import ( "syscall" "time" + "github.com/OpenIMSDK/tools/errs" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "golang.org/x/sync/errgroup" @@ -116,7 +117,7 @@ func Start( // Create a HTTP server for prometheus. httpServer := &http.Server{Handler: promhttp.HandlerFor(reg, promhttp.HandlerOpts{}), Addr: fmt.Sprintf("0.0.0.0:%d", prometheusPort)} if err := httpServer.ListenAndServe(); err != nil { - log.Fatal("Unable to start a http server.") + log.Fatal("Unable to start a http server. ", err.Error(), "PrometheusPort:", prometheusPort) } } return nil diff --git a/scripts/install/openim-crontask.sh b/scripts/install/openim-crontask.sh index beedf1116..6068e97d5 100755 --- a/scripts/install/openim-crontask.sh +++ b/scripts/install/openim-crontask.sh @@ -53,6 +53,7 @@ function openim::crontask::start() { openim::util::stop_services_with_name ${OPENIM_CRONTASK_BINARY} openim::log::status "start cron_task process, path: ${OPENIM_CRONTASK_BINARY}" + nohup ${OPENIM_CRONTASK_BINARY} -c ${OPENIM_PUSH_CONFIG} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE") & openim::util::check_process_names ${SERVER_NAME} diff --git a/scripts/install/openim-rpc.sh b/scripts/install/openim-rpc.sh index 32a638abe..00031f211 100755 --- a/scripts/install/openim-rpc.sh +++ b/scripts/install/openim-rpc.sh @@ -125,6 +125,7 @@ function openim::rpc::start() { for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do # openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES openim::util::stop_services_on_ports ${OPENIM_RPC_PORT_LISTARIES[$i]} + openim::util::stop_services_on_ports ${OPENIM_RPC_PROM_PORT_LISTARIES[$i]} openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}" diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index ba63cb9df..b93f45205 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -451,6 +451,7 @@ openim::util::check_process_names() { cat "$TMP_LOG_FILE" | awk '{print "\033[31m" $0 "\033[0m"}' return 1 else + echo "" openim::log::success "All processes are running." return 0 fi @@ -1690,6 +1691,7 @@ openim::util::check_process_names() { cat "$TMP_LOG_FILE" | awk '{print "\033[31m" $0 "\033[0m"}' return 1 else + echo "" openim::log::success "All processes are running." return 0 fi