|
|
@ -402,7 +402,7 @@ openim::util::check_process_names() {
|
|
|
|
local not_started=()
|
|
|
|
local not_started=()
|
|
|
|
local started=()
|
|
|
|
local started=()
|
|
|
|
|
|
|
|
|
|
|
|
openim::log::info "Checking processes: $*"
|
|
|
|
echo "Checking processes: $*"
|
|
|
|
# Iterate over each given process name
|
|
|
|
# Iterate over each given process name
|
|
|
|
for process_name in "$@"; do
|
|
|
|
for process_name in "$@"; do
|
|
|
|
# Use `pgrep` to find process IDs related to the given process name
|
|
|
|
# Use `pgrep` to find process IDs related to the given process name
|
|
|
@ -1588,7 +1588,7 @@ openim::util::check_ports() {
|
|
|
|
# An array to collect information about processes that are running.
|
|
|
|
# An array to collect information about processes that are running.
|
|
|
|
local started=()
|
|
|
|
local started=()
|
|
|
|
|
|
|
|
|
|
|
|
openim::log::info "Checking ports: $*"
|
|
|
|
echo "Checking ports: $*"
|
|
|
|
# Iterate over each given port.
|
|
|
|
# Iterate over each given port.
|
|
|
|
for port in "$@"; do
|
|
|
|
for port in "$@"; do
|
|
|
|
# Initialize variables
|
|
|
|
# Initialize variables
|
|
|
@ -1634,7 +1634,7 @@ openim::util::check_ports() {
|
|
|
|
|
|
|
|
|
|
|
|
# Print information about ports whose processes are not running.
|
|
|
|
# Print information about ports whose processes are not running.
|
|
|
|
if [[ ${#not_started[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#not_started[@]} -ne 0 ]]; then
|
|
|
|
openim::log::info "\n### Not started ports:"
|
|
|
|
echo "\n### Not started ports:"
|
|
|
|
for port in "${not_started[@]}"; do
|
|
|
|
for port in "${not_started[@]}"; do
|
|
|
|
openim::log::error "Port $port is not started."
|
|
|
|
openim::log::error "Port $port is not started."
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -1642,9 +1642,9 @@ openim::util::check_ports() {
|
|
|
|
|
|
|
|
|
|
|
|
# Print information about ports whose processes are running.
|
|
|
|
# Print information about ports whose processes are running.
|
|
|
|
if [[ ${#started[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#started[@]} -ne 0 ]]; then
|
|
|
|
openim::log::info "\n### Started ports:"
|
|
|
|
echo "\n### Started ports:"
|
|
|
|
for info in "${started[@]}"; do
|
|
|
|
for info in "${started[@]}"; do
|
|
|
|
openim::log::info "$info"
|
|
|
|
echo "$info"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -1693,7 +1693,7 @@ openim::util::check_process_names() {
|
|
|
|
local not_started=()
|
|
|
|
local not_started=()
|
|
|
|
local started=()
|
|
|
|
local started=()
|
|
|
|
|
|
|
|
|
|
|
|
openim::log::info "Checking processes: $*"
|
|
|
|
echo "Checking processes: $*"
|
|
|
|
# Iterate over each given process name
|
|
|
|
# Iterate over each given process name
|
|
|
|
for process_name in "$@"; do
|
|
|
|
for process_name in "$@"; do
|
|
|
|
# Use `pgrep` to find process IDs related to the given process name
|
|
|
|
# Use `pgrep` to find process IDs related to the given process name
|
|
|
@ -1721,7 +1721,7 @@ openim::util::check_process_names() {
|
|
|
|
|
|
|
|
|
|
|
|
# Print information
|
|
|
|
# Print information
|
|
|
|
if [[ ${#not_started[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#not_started[@]} -ne 0 ]]; then
|
|
|
|
openim::log::info "Not started processes:"
|
|
|
|
echo "Not started processes:"
|
|
|
|
for process_name in "${not_started[@]}"; do
|
|
|
|
for process_name in "${not_started[@]}"; do
|
|
|
|
openim::log::error "Process $process_name is not started."
|
|
|
|
openim::log::error "Process $process_name is not started."
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -1729,9 +1729,9 @@ openim::util::check_process_names() {
|
|
|
|
|
|
|
|
|
|
|
|
if [[ ${#started[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#started[@]} -ne 0 ]]; then
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
openim::log::info "Started processes:"
|
|
|
|
echo "Started processes:"
|
|
|
|
for info in "${started[@]}"; do
|
|
|
|
for info in "${started[@]}"; do
|
|
|
|
openim::log::info "$info"
|
|
|
|
echo "$info"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -1764,7 +1764,7 @@ openim::util::stop_services_on_ports() {
|
|
|
|
# An array to collect information about processes that were stopped.
|
|
|
|
# An array to collect information about processes that were stopped.
|
|
|
|
local stopped=()
|
|
|
|
local stopped=()
|
|
|
|
|
|
|
|
|
|
|
|
openim::log::info "Stopping services on ports: $*"
|
|
|
|
echo "Stopping services on ports: $*"
|
|
|
|
# Iterate over each given port.
|
|
|
|
# Iterate over each given port.
|
|
|
|
for port in "$@"; do
|
|
|
|
for port in "$@"; do
|
|
|
|
# Use the `lsof` command to find process information related to the given port.
|
|
|
|
# Use the `lsof` command to find process information related to the given port.
|
|
|
@ -1788,7 +1788,7 @@ openim::util::stop_services_on_ports() {
|
|
|
|
|
|
|
|
|
|
|
|
# Print information about ports whose processes couldn't be stopped.
|
|
|
|
# Print information about ports whose processes couldn't be stopped.
|
|
|
|
if [[ ${#not_stopped[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#not_stopped[@]} -ne 0 ]]; then
|
|
|
|
openim::log::info "Ports that couldn't be stopped:"
|
|
|
|
echo "Ports that couldn't be stopped:"
|
|
|
|
for port in "${not_stopped[@]}"; do
|
|
|
|
for port in "${not_stopped[@]}"; do
|
|
|
|
openim::log::status "Failed to stop service on port $port."
|
|
|
|
openim::log::status "Failed to stop service on port $port."
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -1797,7 +1797,7 @@ openim::util::stop_services_on_ports() {
|
|
|
|
# Print information about ports whose processes were successfully stopped.
|
|
|
|
# Print information about ports whose processes were successfully stopped.
|
|
|
|
if [[ ${#stopped[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#stopped[@]} -ne 0 ]]; then
|
|
|
|
for port in "${stopped[@]}"; do
|
|
|
|
for port in "${stopped[@]}"; do
|
|
|
|
openim::log::info "Successfully stopped service on port $port."
|
|
|
|
echo "Successfully stopped service on port $port."
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -1830,7 +1830,7 @@ 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=()
|
|
|
|
|
|
|
|
|
|
|
|
openim::log::info "Stopping services with names: $*"
|
|
|
|
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.
|
|
|
@ -1867,7 +1867,7 @@ openim::util::stop_services_with_name() {
|
|
|
|
|
|
|
|
|
|
|
|
# Print information about services whose processes couldn't be stopped.
|
|
|
|
# Print information about services whose processes couldn't be stopped.
|
|
|
|
if [[ ${#not_stopped[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#not_stopped[@]} -ne 0 ]]; then
|
|
|
|
openim::log::info "Services that couldn't be stopped:"
|
|
|
|
echo "Services that couldn't be stopped:"
|
|
|
|
for name in "${not_stopped[@]}"; do
|
|
|
|
for name in "${not_stopped[@]}"; do
|
|
|
|
openim::log::status "Failed to stop the $name service."
|
|
|
|
openim::log::status "Failed to stop the $name service."
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -1876,9 +1876,9 @@ openim::util::stop_services_with_name() {
|
|
|
|
# Print information about services whose processes were successfully stopped.
|
|
|
|
# Print information about services whose processes were successfully stopped.
|
|
|
|
if [[ ${#stopped[@]} -ne 0 ]]; then
|
|
|
|
if [[ ${#stopped[@]} -ne 0 ]]; then
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
openim::log::info "Stopped services:"
|
|
|
|
echo "Stopped services:"
|
|
|
|
for name in "${stopped[@]}"; do
|
|
|
|
for name in "${stopped[@]}"; do
|
|
|
|
openim::log::info "Successfully stopped the $name service."
|
|
|
|
echo "Successfully stopped the $name service."
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|