mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-02 18:34:29 +08:00
Optimize script logs
This commit is contained in:
parent
62fc7e22b9
commit
db0ae689ae
@ -409,17 +409,19 @@ for process_name in "$@"; do
|
|||||||
|
|
||||||
# Check if any process IDs were found
|
# Check if any process IDs were found
|
||||||
if [[ ${#pids[@]} -eq 0 ]]; then
|
if [[ ${#pids[@]} -eq 0 ]]; then
|
||||||
not_started+=($process_name)
|
not_started+=("$process_name")
|
||||||
else
|
else
|
||||||
# If there are PIDs, loop through each one
|
# If there are PIDs, loop through each one
|
||||||
for pid in "${pids[@]}"; do
|
for pid in "${pids[@]}"; do
|
||||||
local command=$(ps -p $pid -o cmd=)
|
local command=$(ps -p $pid -o cmd=)
|
||||||
local start_time=$(ps -p $pid -o lstart=)
|
local start_time=$(ps -p $pid -o lstart=)
|
||||||
local port=$(get_port $pid | tr -d '\n') # Use `tr` to remove newline characters
|
local port=$(get_port $pid | tr -d '\n') # Remove newline characters
|
||||||
|
|
||||||
# Check if port information was found for the PID
|
# Ensure port information is followed by a space for separation
|
||||||
if [[ -z $port ]]; then
|
if [[ -z $port ]]; then
|
||||||
port="N/A"
|
port="N/A "
|
||||||
|
else
|
||||||
|
port="$port " # Add a trailing space for separation
|
||||||
fi
|
fi
|
||||||
|
|
||||||
started+=("Process $process_name - Command: $command, PID: $pid, Port: $port, Start time: $start_time")
|
started+=("Process $process_name - Command: $command, PID: $pid, Port: $port, Start time: $start_time")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user