From c4e8b796ac086c76495ce80d7c4ba423b0c86374 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Thu, 21 Mar 2024 17:27:55 +0800 Subject: [PATCH] Optimizing scripts --- scripts/lib/util.sh | 11 ++++++++++- scripts/start-all.sh | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index 85ff15b67..c1b84b4f9 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -2854,13 +2854,22 @@ function openim::util::find_process_ports() { return 1 fi + local ports_info="" 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" + ports_info+="$port($protocol) " done + + + if [[ -z "$ports_info" ]]; then + echo "No ports found for process $process_path." + else + + echo "Process $process_path is listening on ports: $ports_info" + fi } function openim::util::find_ports_for_all_services() { diff --git a/scripts/start-all.sh b/scripts/start-all.sh index 76d0b3d3b..a7e4c8851 100755 --- a/scripts/start-all.sh +++ b/scripts/start-all.sh @@ -120,11 +120,11 @@ 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 openim::log::status "post-start has been successfully completed!" - +openim::util::find_ports_for_all_services ${OPENIM_ALL_SERVICE_LIBRARIES_NO_TRANSFER[@]} openim::log::success "All OpenIM services have been successfully started!" \ No newline at end of file