Optimizing scripts

This commit is contained in:
skiffer-git 2024-03-21 18:50:21 +08:00
parent 753ba6f08f
commit 8c8a0232d9

View File

@ -622,6 +622,10 @@ openim::util::stop_services_with_name() {
# If there's a Process ID, it means the service with the name is running. # If there's a Process ID, it means the service with the name is running.
if [[ -n $pid ]]; then if [[ -n $pid ]]; then
# Print the binary path for the PID
binary_path=$(readlink -f /proc/$pid/exe)
echo "PID $pid corresponds to binary path: $binary_path"
# Try to stop the service by killing its process. # Try to stop the service by killing its process.
if kill -15 $pid 2>/dev/null; then if kill -15 $pid 2>/dev/null; then
stopped_this_time=true stopped_this_time=true
@ -629,6 +633,7 @@ openim::util::stop_services_with_name() {
fi fi
done done
if $stopped_this_time; then if $stopped_this_time; then
stopped+=("$server_name") stopped+=("$server_name")
else else