This commit is contained in:
2026-07-25 17:28:23 -05:00
parent b04e5b706d
commit d47a88587c
7 changed files with 211 additions and 45 deletions
+18 -5
View File
@@ -18,8 +18,21 @@ EXIT1() {
exit 0
}
is_service_running() {
local result=$(ssh root@${1} pgrep $2 | wc -l);
echo $result
local host="${1}"
local process_name="${2}"
local remote_process
printf -v remote_process '%q' "${process_name}"
if ssh -q \
-o BatchMode=yes \
-o ConnectTimeout=3 \
-o ConnectionAttempts=1 \
"root@${host}" \
"pgrep -- ${remote_process} >/dev/null 2>&1"; then
echo true
else
echo false
fi
}
containsElement () {
local e match="$1"
@@ -246,7 +259,7 @@ CHECK_HOST(){
# [ "$(nmap ${1} -p 22,80,443 -n | grep 'open ')" != "" ] || [ "$(nmap -sU ${1} -p 161 -n | grep 'open ')" != "" ] && echo true || echo false
# else
# ping -c 3 ${1} > /dev/null 2>&1
ping -qw 2 -c1 ${1} > /dev/null 2>&1
ping -qw 2 -c1 "${1}" > /dev/null 2>&1
[ $? -ne 0 ] && echo false || echo true
# fi
else
@@ -355,7 +368,7 @@ abet[5]="f"
abet[6]="g"
abet[7]="h"
abet[8]="i"
abet[9]="i"
abet[9]="j"
abet[10]="k"
abet[11]="l"
abet[12]="m"
@@ -365,7 +378,7 @@ abet[15]="p"
abet[16]="q"
abet[17]="r"
abet[18]="s"
abet[19]="v"
abet[19]="t"
abet[20]="u"
abet[21]="v"
abet[22]="w"