mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-06 13:22:11 +08:00
Optimizing scripts
This commit is contained in:
parent
753ba6f08f
commit
8c8a0232d9
@ -613,21 +613,26 @@ openim::util::stop_services_with_name() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
local stopped_this_time=false
|
local stopped_this_time=false
|
||||||
for pid in $pids; do
|
for pid in $pids; do
|
||||||
|
|
||||||
# Exclude the PID of the current script
|
# Exclude the PID of the current script
|
||||||
if [[ "$pid" == "$$" ]]; then
|
if [[ "$pid" == "$$" ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If there's a Process ID, it means the service with the name is running.
|
||||||
|
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.
|
||||||
|
if kill -15 $pid 2>/dev/null; then
|
||||||
|
stopped_this_time=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# If there's a Process ID, it means the service with the name is running.
|
|
||||||
if [[ -n $pid ]]; then
|
|
||||||
# Try to stop the service by killing its process.
|
|
||||||
if kill -15 $pid 2>/dev/null; then
|
|
||||||
stopped_this_time=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if $stopped_this_time; then
|
if $stopped_this_time; then
|
||||||
stopped+=("$server_name")
|
stopped+=("$server_name")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user