Skip to content

Commit

Permalink
Update check-all.sh (#1643)
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw authored Dec 30, 2023
1 parent a7138cb commit bed112d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/check-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ OPENIM_VERBOSE=4

openim::log::info "\n# Begin to check all openim service"

# Elegant printing function
# Elegant printing function
print_services_and_ports() {
local -n service_names=$1
local -n service_ports=$2
local service_names=("$@")
local half_length=$((${#service_names[@]} / 2))
local service_ports=("${service_names[@]:half_length}")

echo "+-------------------------+----------+"
echo "| Service Name | Port |"
echo "+-------------------------+----------+"

for index in "${!service_names[@]}"; do
for ((index=0; index < half_length; index++)); do
printf "| %-23s | %-8s |\n" "${service_names[$index]}" "${service_ports[$index]}"
done

Expand All @@ -50,11 +52,10 @@ print_services_and_ports() {
# Similarly for OPENIM_DEPENDENCY_TARGETS and OPENIM_DEPENDENCY_PORT_TARGETS

# Print out services and their ports
print_services_and_ports OPENIM_SERVER_NAME_TARGETS OPENIM_SERVER_PORT_TARGETS
print_services_and_ports "${OPENIM_SERVER_NAME_TARGETS[@]}" "${OPENIM_SERVER_PORT_TARGETS[@]}"

# Print out dependencies and their ports
print_services_and_ports OPENIM_DEPENDENCY_TARGETS OPENIM_DEPENDENCY_PORT_TARGETS

print_services_and_ports "${OPENIM_DEPENDENCY_TARGETS[@]}" "${OPENIM_DEPENDENCY_PORT_TARGETS[@]}"

# OpenIM check
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
Expand Down Expand Up @@ -91,4 +92,4 @@ else
echo "++++ Check all openim service ports successfully !"
fi

set -e
set -e

0 comments on commit bed112d

Please sign in to comment.