@@ -30,16 +30,18 @@ OPENIM_VERBOSE=4
30
30
31
31
openim::log::info " \n# Begin to check all openim service"
32
32
33
+ # Elegant printing function
33
34
# Elegant printing function
34
35
print_services_and_ports () {
35
- local -n service_names=$1
36
- local -n service_ports=$2
36
+ local service_names=(" $@ " )
37
+ local half_length=$(( ${# service_names[@]} / 2 ))
38
+ local service_ports=(" ${service_names[@]: half_length} " )
37
39
38
40
echo " +-------------------------+----------+"
39
41
echo " | Service Name | Port |"
40
42
echo " +-------------------------+----------+"
41
43
42
- for index in " ${ ! service_names[@]} " ; do
44
+ for (( index= 0 ; index < half_length; index ++ )) ; do
43
45
printf " | %-23s | %-8s |\n" " ${service_names[$index]} " " ${service_ports[$index]} "
44
46
done
45
47
@@ -50,11 +52,10 @@ print_services_and_ports() {
50
52
# Similarly for OPENIM_DEPENDENCY_TARGETS and OPENIM_DEPENDENCY_PORT_TARGETS
51
53
52
54
# Print out services and their ports
53
- print_services_and_ports OPENIM_SERVER_NAME_TARGETS OPENIM_SERVER_PORT_TARGETS
55
+ print_services_and_ports " ${ OPENIM_SERVER_NAME_TARGETS[@]} " " ${ OPENIM_SERVER_PORT_TARGETS[@]} "
54
56
55
57
# Print out dependencies and their ports
56
- print_services_and_ports OPENIM_DEPENDENCY_TARGETS OPENIM_DEPENDENCY_PORT_TARGETS
57
-
58
+ print_services_and_ports " ${OPENIM_DEPENDENCY_TARGETS[@]} " " ${OPENIM_DEPENDENCY_PORT_TARGETS[@]} "
58
59
59
60
# OpenIM check
60
61
echo " ++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]} "
91
92
echo " ++++ Check all openim service ports successfully !"
92
93
fi
93
94
94
- set -e
95
+ set -e
0 commit comments