scripts for Mac

This commit is contained in:
skiffer-git 2024-03-19 15:24:23 +08:00
parent e81803a53d
commit 0e61c3acef

View File

@ -397,7 +397,7 @@ openim::util::check_process_names() {
return 1 return 1
fi fi
} }
# Arrays to collect details of processes # Arrays to collect details of processes
local not_started=() local not_started=()
local started=() local started=()
@ -413,11 +413,7 @@ openim::util::check_process_names() {
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
echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
local command=$(ps -p $pid -o comm=) local command=$(ps -p $pid -o comm=)
echo "ps -p $pid -o comm="
local start_time=$(ps -p $pid -o lstart=) local start_time=$(ps -p $pid -o lstart=)
local port=$(get_port $pid) local port=$(get_port $pid)
@ -427,12 +423,11 @@ openim::util::check_process_names() {
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")
echo bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb $started
done done
fi fi
done done
# Print information # Print information
if [[ ${#not_started[@]} -ne 0 ]]; then if [[ ${#not_started[@]} -ne 0 ]]; then
echo "Not started processes:" echo "Not started processes:"
@ -440,7 +435,7 @@ openim::util::check_process_names() {
echo "Process $process_name is not started." echo "Process $process_name is not started."
done done
fi fi
if [[ ${#started[@]} -ne 0 ]]; then if [[ ${#started[@]} -ne 0 ]]; then
echo echo
echo "Started processes:" echo "Started processes:"
@ -448,7 +443,7 @@ openim::util::check_process_names() {
echo "$info" echo "$info"
done done
fi fi
# Return status # Return status
if [[ ${#not_started[@]} -ne 0 ]]; then if [[ ${#not_started[@]} -ne 0 ]]; then
openim::color::echo $COLOR_RED "OpenIM Stdout Log >> cat ${LOG_FILE}" openim::color::echo $COLOR_RED "OpenIM Stdout Log >> cat ${LOG_FILE}"
@ -494,7 +489,7 @@ openim::util::check_process_names_for_stop() {
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 comm=)
local start_time=$(ps -p $pid -o lstart=) local start_time=$(ps -p $pid -o lstart=)
local port=$(get_port $pid) local port=$(get_port $pid)