Script Refactoring

pull/2148/head
skiffer-git 2 years ago
parent 8a05e19eef
commit a2485d6079

@ -2833,11 +2833,10 @@ function openim::util::find_ports_for_all_services() {
check_binary_ports() { check_binary_ports() {
binary_path="$1" binary_path="$1"
binary_name=$(basename "$binary_path")
# Check if the binary is running # Check if the binary is running
if pgrep -f "$binary_path" > /dev/null; then if pgrep -f "$binary_path" > /dev/null; then
echo "$binary_name is running." "arg $1" # echo "$binary_name is running." "arg $1"
# Find the PID(s) of the running binary # Find the PID(s) of the running binary
pids=$(pgrep -f "$binary_path") pids=$(pgrep -f "$binary_path")
@ -2863,12 +2862,12 @@ check_binary_ports() {
ports=$(echo "$ports" | xargs | tr ' ' '\n' | uniq | tr '\n' ' ') ports=$(echo "$ports" | xargs | tr ' ' '\n' | uniq | tr '\n' ' ')
if [ -z "$ports" ]; then if [ -z "$ports" ]; then
echo "$binary_name is not listening on any ports." echo "$binary_path is not listening on any ports."
else else
echo "$binary_name is listening on the following ports: $ports" echo "$binary_path is listening on the following ports: $ports"
fi fi
else else
echo "$binary_name is not running." echo "$binary_path is not running."
fi fi
} }

Loading…
Cancel
Save