diff --git a/scripts/check-all.sh b/scripts/check-all.sh index d5edefd30..3751f4f09 100755 --- a/scripts/check-all.sh +++ b/scripts/check-all.sh @@ -94,18 +94,18 @@ if [[ $? -ne 0 ]]; then fi -echo "Check openim service name:" +echo "Check OpenIM service name:" for item in "${OPENIM_ALL_SERVICE_LIBRARIES_NO_TRANSFER[@]}"; do echo "$item" done result=$(openim::util::check_process_names ${OPENIM_ALL_SERVICE_LIBRARIES_NO_TRANSFER[@]}) if [[ $? -ne 0 ]]; then - echo "+++ cat openim log file >>> ${LOG_FILE}" + echo "+++ cat OpenIM log file >>> ${LOG_FILE}" openim::log::error "check process failed.\n " echo "$result" exit 1 else - openim::log::success "All openim services are running normally! " + openim::log::success "All OpenIM services are running normally! " fi diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index 7bcfbad97..1341e12c9 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -2847,6 +2847,34 @@ function openim::util::check_process_names_for_stop() { +function openim::util::find_process_ports() { + local process_path="$1" + if [[ -z "$process_path" ]]; then + echo "Usage: find_process_ports /path/to/process" + return 1 + fi + + + lsof -nP -iTCP -iUDP | grep LISTEN | grep "$(pgrep -f $process_path)" | awk '{print $9, $8}' | while read line; do + local port_protocol=($line) + local port=${port_protocol[0]##*:} + local protocol=${port_protocol[1]} + echo "Process $process_path is listening on port $port with protocol $protocol" + done +} + +function openim::util::find_ports_for_all_services() { + local services=("$@") + for service in "${services[@]}"; do + find_process_ports "$service" + done +} + + + + + + if [[ "$*" =~ openim::util:: ]];then eval $* diff --git a/scripts/start-all.sh b/scripts/start-all.sh index 88a1c4e6c..93badf639 100755 --- a/scripts/start-all.sh +++ b/scripts/start-all.sh @@ -120,6 +120,9 @@ if [[ $? -ne 0 ]]; then exit 1 fi +openim::util::find_ports_for_all_services ${OPENIM_ALL_SERVICE_LIBRARIES_NO_TRANSFER[@]} + + openim::log::status "Start the post-start tools:" ${TOOLS_START_SCRIPTS_PATH} openim::tools::post-start