mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-06 05:12:10 +08:00
Optimizing scripts
This commit is contained in:
parent
dbb318d125
commit
388155f4b3
@ -94,18 +94,18 @@ if [[ $? -ne 0 ]]; then
|
||||
fi
|
||||
|
||||
|
||||
echo "Check openim service name:"
|
||||
echo "Check OpenIM service name:"
|
||||
for item in "${OPENIM_ALL_SERVICE_LIBRARIES_NO_TRANSFER[@]}"; do
|
||||
echo "$item"
|
||||
done
|
||||
|
||||
result=$(openim::util::check_process_names ${OPENIM_ALL_SERVICE_LIBRARIES_NO_TRANSFER[@]})
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "+++ cat openim log file >>> ${LOG_FILE}"
|
||||
echo "+++ cat OpenIM log file >>> ${LOG_FILE}"
|
||||
openim::log::error "check process failed.\n "
|
||||
echo "$result"
|
||||
exit 1
|
||||
else
|
||||
openim::log::success "All openim services are running normally! "
|
||||
openim::log::success "All OpenIM services are running normally! "
|
||||
fi
|
||||
|
||||
|
||||
@ -2847,6 +2847,34 @@ function openim::util::check_process_names_for_stop() {
|
||||
|
||||
|
||||
|
||||
function openim::util::find_process_ports() {
|
||||
local process_path="$1"
|
||||
if [[ -z "$process_path" ]]; then
|
||||
echo "Usage: find_process_ports /path/to/process"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
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"
|
||||
done
|
||||
}
|
||||
|
||||
function openim::util::find_ports_for_all_services() {
|
||||
local services=("$@")
|
||||
for service in "${services[@]}"; do
|
||||
find_process_ports "$service"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if [[ "$*" =~ openim::util:: ]];then
|
||||
eval $*
|
||||
|
||||
@ -120,6 +120,9 @@ 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user