|
|
@ -384,20 +384,19 @@ openim::util::check_ports() {
|
|
|
|
# The function returns a status of 1 if any of the processes is not running.
|
|
|
|
# The function returns a status of 1 if any of the processes is not running.
|
|
|
|
openim::util::check_process_names() {
|
|
|
|
openim::util::check_process_names() {
|
|
|
|
# Function to get the port of a process
|
|
|
|
# Function to get the port of a process
|
|
|
|
get_port() {
|
|
|
|
get_port() {
|
|
|
|
local pid=$1
|
|
|
|
local pid=$1
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
# Linux
|
|
|
|
# Linux
|
|
|
|
ss -ltnp 2>/dev/null | grep $pid | awk '{print $4}' | cut -d ':' -f2 | tr '\n' ' '
|
|
|
|
ss -ltnp 2>/dev/null | grep $pid | awk '{print $4}' | cut -d ':' -f2
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
# macOS
|
|
|
|
# macOS
|
|
|
|
lsof -nP -iTCP -sTCP:LISTEN -a -p $pid | awk 'NR>1 {print $9}' | sed 's/.*://' | tr '\n' ' '
|
|
|
|
lsof -nP -iTCP -sTCP:LISTEN -a -p $pid | awk 'NR>1 {print $9}' | sed 's/.*://'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "Unsupported OS"
|
|
|
|
echo "Unsupported OS"
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Arrays to collect details of processes
|
|
|
|
# Arrays to collect details of processes
|
|
|
|
local not_started=()
|
|
|
|
local not_started=()
|
|
|
|