diff --git a/scripts/check-all-by-signal.sh b/scripts/check-all-by-signal.sh index 71011c51a..9878f691d 100644 --- a/scripts/check-all-by-signal.sh +++ b/scripts/check-all-by-signal.sh @@ -29,7 +29,8 @@ source "${OPENIM_ROOT}/scripts/install/common.sh" OPENIM_VERBOSE=4 openim::log::info "\n# Begin to check all openim service" -. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check_by_signal || ture +. $(dirname ${BASH_SOURCE})/install/openim-msgtransfer.sh openim::msgtransfer::check_by_signal +openim::log::info "\n# to check all openim service态nnnnnnnnnnnnnn" handle_error() { echo "An error occurred. Printing ${STDERR_LOG_FILE} contents:" @@ -40,11 +41,6 @@ trap handle_error ERR echo "Check ports:" openim::util::check_ports_by_signal ${OPENIM_SERVER_PORT_LISTARIES[@]} -if [[ $? -ne 0 ]]; then - openim::log::error "The service does not stop properly, there are still processes running, please check!" -else - openim::log::success "++++ All openim service ports stop successfully !" -fi set -e diff --git a/scripts/install/openim-msgtransfer.sh b/scripts/install/openim-msgtransfer.sh index ac612d20b..48218dc41 100755 --- a/scripts/install/openim-msgtransfer.sh +++ b/scripts/install/openim-msgtransfer.sh @@ -88,16 +88,18 @@ function openim::msgtransfer::check() { } function openim::msgtransfer::check_by_signal() { - PIDS=$(pgrep -f "${OPENIM_OUTPUT_HOSTBIN}/openim-msgtransfer") + PIDS=$(pgrep -f "${OPENIM_OUTPUT_HOSTBIN}/openim-msgtransfer") || PIDS="0" + if [ "$PIDS" = "0" ]; then + return 0 + fi + NUM_PROCESSES=$(echo "$PIDS" | wc -l | xargs) - echo "1111111111111" if [ "$NUM_PROCESSES" -gt 0 ]; then openim::log::error "Found $NUM_PROCESSES processes for $OPENIM_OUTPUT_HOSTBIN/openim-msgtransfer" for PID in $PIDS; do if [[ "$OSTYPE" == "linux-gnu"* ]]; then echo -e "\033[31m$(ps -p $PID -o pid,cmd)\033[0m" - ps -p $PID -o pid,cmd elif [[ "$OSTYPE" == "darwin"* ]]; then echo -e "\033[31m$(ps -p $PID -o pid,comm)\033[0m" else @@ -108,7 +110,6 @@ function openim::msgtransfer::check_by_signal() { else openim::log::success "All openim-msgtransfer processes have been stopped properly." fi - echo "2222222222222" return 0 } diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index 5431a0307..c90609e23 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -440,10 +440,8 @@ openim::util::check_ports_by_signal() { # If any of the processes is not running, return a status of 1. if [[ ${#not_started[@]} -ne 0 ]]; then openim::log::success "All specified processes are running." - return 0 else openim::log::error "Have processes no stop." - return 1 fi }