From 2e7adecff3999d351fc3444502c29e39cce90574 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Thu, 21 Mar 2024 18:06:21 +0800 Subject: [PATCH] Optimizing scripts --- scripts/lib/util.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index 89408a61b..05da8c385 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -2865,8 +2865,12 @@ function openim::util::find_process_ports() { done < <(lsof -nP -iTCP -iUDP | grep LISTEN | grep "$(pgrep -f "$process_path")" | awk '{print $9, $8}') protocol_ports=${protocol_ports%, } - echo "Process $process_path is listening on protocol & port: $protocol_ports " + if [[ -z "$protocol_ports" ]]; then + echo "Process $process_path is not listening on any ports" + else + echo "Process $process_path is listening on protocol & port: $protocol_ports" + fi }