diff --git a/scripts/install/openim-api.sh b/scripts/install/openim-api.sh index 631a0ee3a..c81dfcd0d 100755 --- a/scripts/install/openim-api.sh +++ b/scripts/install/openim-api.sh @@ -34,12 +34,15 @@ readonly OPENIM_API_SERVICE_TARGETS=( readonly OPENIM_API_SERVICE_LISTARIES=("${OPENIM_API_SERVICE_TARGETS[@]##*/}") function openim::api::start() { + + rm -rf "$TMP_LOG_FILE" + echo "++ OPENIM_API_SERVICE_LISTARIES: ${OPENIM_API_SERVICE_LISTARIES[@]}" echo "++ OPENIM_API_PORT_LISTARIES: ${OPENIM_API_PORT_LISTARIES[@]}" echo "++ OpenIM API config path: ${OPENIM_API_CONFIG}" - + openim::log::info "Starting ${SERVER_NAME} ..." - + printf "+------------------------+--------------+\n" printf "| Service Name | Port |\n" printf "+------------------------+--------------+\n" diff --git a/scripts/install/openim-crontask.sh b/scripts/install/openim-crontask.sh index c8d46c5ce..beedf1116 100755 --- a/scripts/install/openim-crontask.sh +++ b/scripts/install/openim-crontask.sh @@ -44,6 +44,9 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P) SERVER_NAME="openim-crontask" function openim::crontask::start() { + + rm -rf "$TMP_LOG_FILE" + openim::log::info "Start OpenIM Cron, binary root: ${SERVER_NAME}" openim::log::status "Start OpenIM Cron, path: ${OPENIM_CRONTASK_BINARY}" diff --git a/scripts/install/openim-msggateway.sh b/scripts/install/openim-msggateway.sh index 641eaf02e..4e591deca 100755 --- a/scripts/install/openim-msggateway.sh +++ b/scripts/install/openim-msggateway.sh @@ -26,6 +26,9 @@ openim::util::set_max_fd 200000 SERVER_NAME="openim-msggateway" function openim::msggateway::start() { + + rm -rf "$TMP_LOG_FILE" + openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}" openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGGATEWAY_BINARY}" diff --git a/scripts/install/openim-msgtransfer.sh b/scripts/install/openim-msgtransfer.sh index 0e2622d5d..def22c38b 100755 --- a/scripts/install/openim-msgtransfer.sh +++ b/scripts/install/openim-msgtransfer.sh @@ -28,6 +28,9 @@ openim::util::set_max_fd 200000 SERVER_NAME="openim-msgtransfer" function openim::msgtransfer::start() { + + rm -rf "$TMP_LOG_FILE" + openim::log::info "Start OpenIM Msggateway, binary root: ${SERVER_NAME}" openim::log::status "Start OpenIM Msggateway, path: ${OPENIM_MSGTRANSFER_BINARY}" @@ -57,8 +60,6 @@ function openim::msgtransfer::start() { PROMETHEUS_PORT_OPTION="--prometheus_port ${OPENIM_PROMETHEUS_PORTS[$i]}" fi nohup ${OPENIM_MSGTRANSFER_BINARY} ${PROMETHEUS_PORT_OPTION} -c ${OPENIM_MSGTRANSFER_CONFIG} -n ${i} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE") & - PID=$! - wait $PID done openim::util::check_process_names "${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME}" diff --git a/scripts/install/openim-push.sh b/scripts/install/openim-push.sh index f7bd58649..4d14ca675 100755 --- a/scripts/install/openim-push.sh +++ b/scripts/install/openim-push.sh @@ -50,6 +50,9 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P) SERVER_NAME="openim-push" function openim::push::start() { + + rm -rf "$TMP_LOG_FILE" + openim::log::status "Start OpenIM Push, binary root: ${SERVER_NAME}" openim::log::info "Start OpenIM Push, path: ${OPENIM_PUSH_BINARY}" @@ -71,10 +74,8 @@ function openim::push::start() { for (( i=0; i<${#OPENIM_PUSH_PORTS_ARRAY[@]}; i++ )); do openim::log::info "start push process, port: ${OPENIM_PUSH_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_PROM_PORTS_ARRAY[$i]}" nohup ${OPENIM_PUSH_BINARY} --port ${OPENIM_PUSH_PORTS_ARRAY[$i]} -c ${OPENIM_PUSH_CONFIG} --prometheus_port ${PUSH_PROM_PORTS_ARRAY[$i]} >${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE") & - PID=$! - wait $PID done - + openim::util::check_process_names ${SERVER_NAME} } diff --git a/scripts/install/openim-rpc.sh b/scripts/install/openim-rpc.sh index 87a315841..32a638abe 100755 --- a/scripts/install/openim-rpc.sh +++ b/scripts/install/openim-rpc.sh @@ -102,6 +102,8 @@ readonly OPENIM_RPC_PROM_PORT_TARGETS readonly OPENIM_RPC_PROM_PORT_LISTARIES=("${OPENIM_RPC_PROM_PORT_TARGETS[@]##*/}") function openim::rpc::start() { + rm -rf "$TMP_LOG_FILE" + echo "OPENIM_RPC_SERVICE_LISTARIES: ${OPENIM_RPC_SERVICE_LISTARIES[@]}" echo "OPENIM_RPC_PROM_PORT_LISTARIES: ${OPENIM_RPC_PROM_PORT_LISTARIES[@]}" echo "OPENIM_RPC_PORT_LISTARIES: ${OPENIM_RPC_PORT_LISTARIES[@]}" diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index a40668d70..f41be8eaf 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -360,7 +360,11 @@ openim::util::check_ports() { # If any of the processes is not running, return a status of 1. if [[ ${#not_started[@]} -ne 0 ]]; then - echo "++++ OpenIM Log >> cat ${LOG_FILE}" + echo "" + echo "!!! OpenIM Stdout Log >> cat ${LOG_FILE}" + echo "!!! OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}" + echo "" + cat "$TMP_LOG_FILE" return 1 else openim::log::success "All specified processes are running." @@ -445,6 +449,9 @@ openim::util::check_process_names() { # Return status if [[ ${#not_started[@]} -ne 0 ]]; then echo "++++ OpenIM Log >> cat ${LOG_FILE}" + echo "!!! OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}" + echo "" + cat "$TMP_LOG_FILE" return 1 else openim::log::success "All processes are running." @@ -1595,6 +1602,9 @@ openim::util::check_ports() { # If any of the processes is not running, return a status of 1. if [[ ${#not_started[@]} -ne 0 ]]; then echo "++++ OpenIM Log >> cat ${LOG_FILE}" + echo "!!! OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}" + echo "" + cat "$TMP_LOG_FILE" return 1 else openim::log::success "All specified processes are running." @@ -1679,6 +1689,9 @@ openim::util::check_process_names() { # Return status if [[ ${#not_started[@]} -ne 0 ]]; then echo "++++ OpenIM Log >> cat ${LOG_FILE}" + echo "!!! OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}" + echo "" + cat "$TMP_LOG_FILE" return 1 else openim::log::success "All processes are running." diff --git a/tools/ncpu/ncpu.go b/tools/ncpu/ncpu.go index 7ca3dff5e..ca2409a6f 100644 --- a/tools/ncpu/ncpu.go +++ b/tools/ncpu/ncpu.go @@ -1,17 +1,3 @@ -// 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. - package main import ( @@ -22,6 +8,11 @@ import ( ) func main() { - maxprocs.Set() - fmt.Print(runtime.GOMAXPROCS(0)) + // Set maxprocs with a custom logger that does nothing to ignore logs. + maxprocs.Set(maxprocs.Logger(func(string, ...interface{}) { + // Intentionally left blank to suppress all log output from automaxprocs. + })) + + // Now this will print the GOMAXPROCS value without printing the automaxprocs log message. + fmt.Println(runtime.GOMAXPROCS(0)) }