mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 03:42:08 +08:00
Optimizing scripts
This commit is contained in:
parent
8c8a0232d9
commit
52034e2db0
@ -599,11 +599,9 @@ openim::util::stop_services_with_name() {
|
|||||||
# An array to collect information about processes that were stopped.
|
# An array to collect information about processes that were stopped.
|
||||||
local stopped=()
|
local stopped=()
|
||||||
|
|
||||||
echo "Stopping services with names: $*"
|
|
||||||
# Iterate over each given service name.
|
# Iterate over each given service name.
|
||||||
for server_name in "$@"; do
|
for server_name in "$@"; do
|
||||||
# Use the `pgrep` command to find process IDs related to the given service name.
|
# Use the `pgrep` command to find process IDs related to the given service name.
|
||||||
echo "Stopping services with name: $server_name"
|
|
||||||
local pids=$(pgrep -f "$server_name")
|
local pids=$(pgrep -f "$server_name")
|
||||||
echo "Stopping services with name: $server_name "$pids
|
echo "Stopping services with name: $server_name "$pids
|
||||||
|
|
||||||
@ -624,7 +622,7 @@ openim::util::stop_services_with_name() {
|
|||||||
if [[ -n $pid ]]; then
|
if [[ -n $pid ]]; then
|
||||||
# Print the binary path for the PID
|
# Print the binary path for the PID
|
||||||
binary_path=$(readlink -f /proc/$pid/exe)
|
binary_path=$(readlink -f /proc/$pid/exe)
|
||||||
echo "PID $pid corresponds to binary path: $binary_path"
|
openim::log::colorless "stop PID $pid 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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user