update
This commit is contained in:
13
defaults.inc
13
defaults.inc
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
VERS='4.8.11-07042023'
|
VERS='4.8.15-07042023'
|
||||||
|
|
||||||
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns '
|
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns '
|
||||||
CERT_DAEMON='/snap/bin/certbot'
|
CERT_DAEMON='/snap/bin/certbot'
|
||||||
@@ -109,8 +109,8 @@ if [ -f ${NM_FOLDER}/defaults.local.inc ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
TSI=$(/sbin/ip link | grep tailscale0)
|
TSI=$(/sbin/ip link | grep tailscale0)
|
||||||
[ ${#TSI} != 0 ] && TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || TSIP=
|
[ ${#TSI} != 0 ] && RUN_NODE_TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || RUN_NODE_TSIP=
|
||||||
RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
RNIP=${RUN_NODE_IP}
|
||||||
for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
||||||
var=${NTYPE}_HOSTS[@]
|
var=${NTYPE}_HOSTS[@]
|
||||||
RUN_NODE_TYPE=""
|
RUN_NODE_TYPE=""
|
||||||
@@ -119,17 +119,14 @@ for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
|||||||
RUN_NODE_TYPE=${NTYPE};
|
RUN_NODE_TYPE=${NTYPE};
|
||||||
RUN_NODE_IP=${RNIP}
|
RUN_NODE_IP=${RNIP}
|
||||||
break 2
|
break 2
|
||||||
elif [[ "${TSIP}" == *"${nip}"* ]]; then
|
elif [[ "${RUN_NODE_TSIP}" == *"${nip}"* ]]; then
|
||||||
RUN_NODE_TYPE=${NTYPE};
|
RUN_NODE_TYPE=${NTYPE};
|
||||||
RUN_NODE_IP=${TSIP}
|
RUN_NODE_IP=${RUN_NODE_TSIP}
|
||||||
break 2
|
break 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "RUN_NODE_IP: $RUN_NODE_IP"
|
|
||||||
echo "RUN_NODE_TYPE: $RUN_NODE_TYPE"
|
|
||||||
|
|
||||||
declare -A NM_SRVCOPTS
|
declare -A NM_SRVCOPTS
|
||||||
NM_SRVCOPTS['status']='Status'
|
NM_SRVCOPTS['status']='Status'
|
||||||
NM_SRVCOPTS['start']='Start'
|
NM_SRVCOPTS['start']='Start'
|
||||||
|
|||||||
@@ -510,17 +510,6 @@ SITEINFO(){
|
|||||||
cw_spc6=8
|
cw_spc6=8
|
||||||
cw_spc7=15
|
cw_spc7=15
|
||||||
dl=110
|
dl=110
|
||||||
MIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
|
||||||
for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
|
||||||
var=${NTYPE}_HOSTS[@]
|
|
||||||
NODE_TYPE=""
|
|
||||||
for nip in "${!var}"; do
|
|
||||||
if [[ "${MIP}" == *"${nip}"* ]]; then
|
|
||||||
NODE_TYPE=${NTYPE};
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${1}" == "edit" ]; then
|
if [ "${1}" == "edit" ]; then
|
||||||
[ "${2}" == "" ] && echo -e "${idsCL[LightGreen]}Choose a site from the list below to edit: ${idsCL[Default]}"
|
[ "${2}" == "" ] && echo -e "${idsCL[LightGreen]}Choose a site from the list below to edit: ${idsCL[Default]}"
|
||||||
@@ -528,7 +517,7 @@ SITEINFO(){
|
|||||||
echo -e "${idsCL[LightGreen]}Local NGINX Sites ${idsCL[Default]}"
|
echo -e "${idsCL[LightGreen]}Local NGINX Sites ${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gosite=${NODE_TYPE}_NGINX_SITES
|
gosite=${RUN_NODE_TYPE}_NGINX_SITES
|
||||||
declare -A SITELIST
|
declare -A SITELIST
|
||||||
if [ "${!gosite}" != "" ]; then
|
if [ "${!gosite}" != "" ]; then
|
||||||
sites=$(find ${!gosite}/*); i=0
|
sites=$(find ${!gosite}/*); i=0
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ CHECK_DOCKER_SERVICES(){
|
|||||||
nid=1
|
nid=1
|
||||||
|
|
||||||
for nip in "${!hosts}"; do
|
for nip in "${!hosts}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
|
||||||
else NCMD="ssh root@${nip}"; LH=''
|
else NCMD="ssh root@${nip}"; LH=''
|
||||||
fi
|
fi
|
||||||
if [ "${NCMD}" != "" ]; then
|
if [ "${NCMD}" != "" ]; then
|
||||||
@@ -138,7 +138,7 @@ SET-PERMISSIONS(){
|
|||||||
if [ "${1}" = "gitea" ]; then
|
if [ "${1}" = "gitea" ]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${WEB_HOSTS[@]}"; do
|
for nip in "${WEB_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
NCMD="ssh root@${nip}"
|
NCMD="ssh root@${nip}"
|
||||||
@@ -163,7 +163,7 @@ SET-PERMISSIONS(){
|
|||||||
elif [ "${1}" = "pdnsadmin" ]; then
|
elif [ "${1}" = "pdnsadmin" ]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${WEB_HOSTS[@]}"; do
|
for nip in "${WEB_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
NCMD="ssh root@${nip}"
|
NCMD="ssh root@${nip}"
|
||||||
@@ -185,7 +185,7 @@ SET-PERMISSIONS(){
|
|||||||
done
|
done
|
||||||
elif [ "${1}" = "nextcloud" ]; then
|
elif [ "${1}" = "nextcloud" ]; then
|
||||||
nip=${NC_HOSTS[0]}
|
nip=${NC_HOSTS[0]}
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
NCMD="ssh root@${nip}"
|
NCMD="ssh root@${nip}"
|
||||||
@@ -215,7 +215,7 @@ SET-PERMISSIONS(){
|
|||||||
for nip in "${MYSQL_HOSTS[@]}"; do
|
for nip in "${MYSQL_HOSTS[@]}"; do
|
||||||
checkhost=$(CHECK_HOST ${nip})
|
checkhost=$(CHECK_HOST ${nip})
|
||||||
if [ "${checkhost}" != "false" ]; then
|
if [ "${checkhost}" != "false" ]; then
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -235,7 +235,7 @@ SET-PERMISSIONS(){
|
|||||||
for nip in "${WEB_HOSTS[@]}"; do
|
for nip in "${WEB_HOSTS[@]}"; do
|
||||||
checkhost=$(CHECK_HOST ${nip})
|
checkhost=$(CHECK_HOST ${nip})
|
||||||
if [ "${checkhost}" != "false" ]; then
|
if [ "${checkhost}" != "false" ]; then
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -283,16 +283,12 @@ SET-PERMISSIONS(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SERVICE(){
|
SERVICE(){
|
||||||
TSI=$(/sbin/ip link | grep tailscale0)
|
|
||||||
MIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
|
||||||
[ ${#TSI} != 0 ] && TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || TSIP=""
|
|
||||||
NODE_TYPE=''
|
|
||||||
#var=NC_HOSTS[@]
|
#var=NC_HOSTS[@]
|
||||||
|
|
||||||
if [ "$1" = "glusterd" ]; then
|
if [ "$1" = "glusterd" ]; then
|
||||||
|
|
||||||
for nip in "${GL_HOSTS[@]}"; do
|
for nip in "${GL_HOSTS[@]}"; do
|
||||||
if [[ "${MIP}" == *"${nip}"* ]]; then
|
if [[ "${RUN_NODE_IP}" == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -328,7 +324,7 @@ SERVICE(){
|
|||||||
sleep 5s
|
sleep 5s
|
||||||
|
|
||||||
for nip in "${GL_HOSTS[@]}"; do
|
for nip in "${GL_HOSTS[@]}"; do
|
||||||
if [[ "${MIP}" == *"${nip}"* ]]; then
|
if [[ "${RUN_NODE_IP}" == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -379,33 +375,10 @@ SERVICE(){
|
|||||||
|
|
||||||
else
|
else
|
||||||
if [ "${4}" != "all" ]; then
|
if [ "${4}" != "all" ]; then
|
||||||
for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
if [ "${RUN_NODE_TYPE}" != "" ]; then
|
||||||
var=${NTYPE}_HOSTS[@]
|
NT_HOSTS=${RUN_NODE_TYPE}_HOSTS[@]
|
||||||
NODE_TYPE=""
|
NT_HOST=${RUN_NODE_TYPE}_HOSTS[0]
|
||||||
for nip in "${!var}"; do
|
NTS=("${RUN_NODE_TYPE}");
|
||||||
if [[ "${MIP}" == *"${nip}"* ]]; then
|
|
||||||
NODE_TYPE=${NTYPE};
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${NODE_TYPE}" == "" ] && [ ${#TSI} != 0 ]; then
|
|
||||||
for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
|
||||||
var=${NTYPE}_HOSTS[@]
|
|
||||||
for nip in "${!var}"; do
|
|
||||||
if [[ "${TSIP}" == *"${nip}"* ]]; then
|
|
||||||
NODE_TYPE=${NTYPE};
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${NODE_TYPE}" != "" ]; then
|
|
||||||
NT_HOSTS=${NODE_TYPE}_HOSTS[@]
|
|
||||||
NT_HOST=${NODE_TYPE}_HOSTS[0]
|
|
||||||
NTS=("${NODE_TYPE}");
|
|
||||||
else
|
else
|
||||||
NTS=(${NM_NODE_TYPES[*]})
|
NTS=(${NM_NODE_TYPES[*]})
|
||||||
fi
|
fi
|
||||||
@@ -414,7 +387,7 @@ SERVICE(){
|
|||||||
NTS=(${NM_NODE_TYPES[*]})
|
NTS=(${NM_NODE_TYPES[*]})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if [ "${NODE_TYPE}" == "" ]; then
|
# if [ "${RUN_NODE_TYPE}" == "" ]; then
|
||||||
#
|
#
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
@@ -440,30 +413,30 @@ SERVICE(){
|
|||||||
|
|
||||||
|
|
||||||
if [ "${1}" = "nginx" ]; then
|
if [ "${1}" = "nginx" ]; then
|
||||||
[ "${NODE_TYPE}" != "" ] && [ "${NM_REPL_NGINX_PATHS[${NODE_TYPE}]}" != "" ] &&
|
[ "${RUN_NODE_TYPE}" != "" ] && [ "${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}" != "" ] &&
|
||||||
|
|
||||||
if [ "${2}" = "restart" ] || [ "${2}" = "reload" ]; then
|
if [ "${2}" = "restart" ] || [ "${2}" = "reload" ]; then
|
||||||
if [ "${3}" != "ns" ]; then
|
if [ "${3}" != "ns" ]; then
|
||||||
if [ "${3}" != "q" ]; then
|
if [ "${3}" != "q" ]; then
|
||||||
echo -en "${idsCL[LightYellow]}Verifying replication across the nodes... ${idsCL[Default]}"
|
echo -en "${idsCL[LightYellow]}Verifying replication across the nodes... ${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
if [[ "${MIP}" == *"${!NT_HOST}"* ]]; then
|
if [[ "${RUN_NODE_IP}" == *"${!NT_HOST}"* ]]; then
|
||||||
PH_CMD=""
|
PH_CMD=""
|
||||||
else
|
else
|
||||||
PH_CMD="ssh root@${!NT_HOST}"
|
PH_CMD="ssh root@${!NT_HOST}"
|
||||||
fi
|
fi
|
||||||
${PH_CMD} touch ${NM_REPL_NGINX_PATHS[${NODE_TYPE}]}/test.repl
|
${PH_CMD} touch ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl
|
||||||
# ${PH_CMD} "echo -e \"Service ${1} ${2}\" >> ${NM_REPL_NGINX_PATHS[${NODE_TYPE}]}/test.repl"
|
# ${PH_CMD} "echo -e \"Service ${1} ${2}\" >> ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl"
|
||||||
for nip in "${!NT_HOSTS}"; do
|
for nip in "${!NT_HOSTS}"; do
|
||||||
checkhost=$(CHECK_HOST ${nip})
|
checkhost=$(CHECK_HOST ${nip})
|
||||||
if [ "${checkhost}" != "false" ] && [ "${nip}" != "${!NT_HOST}" ]; then
|
if [ "${checkhost}" != "false" ] && [ "${nip}" != "${!NT_HOST}" ]; then
|
||||||
checked=false
|
checked=false
|
||||||
until [ "${checked}" = "true" ]; do
|
until [ "${checked}" = "true" ]; do
|
||||||
checked="`${PH_CMD} ssh root@${nip} [ -f ${NM_REPL_NGINX_PATHS[${NODE_TYPE}]}/test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_NGINX_PATHS[${NODE_TYPE}]}/test.repl)) -le 90 ] && echo true`"
|
checked="`${PH_CMD} ssh root@${nip} [ -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl)) -le 90 ] && echo true`"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
${PH_CMD} rm -f ${NM_REPL_NGINX_PATHS[${NODE_TYPE}]}/test.repl
|
${PH_CMD} rm -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -473,7 +446,7 @@ SERVICE(){
|
|||||||
if [ "${3}" != "q" ]; then
|
if [ "${3}" != "q" ]; then
|
||||||
echo -en "${idsCL[LightYellow]}Verifying Apache config and ssl cert replication across the nodes... ${idsCL[Default]}"
|
echo -en "${idsCL[LightYellow]}Verifying Apache config and ssl cert replication across the nodes... ${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
if [[ "${MIP}" == *"${!NT_HOST}"* ]]; then
|
if [[ "${RUN_NODE_IP}" == *"${!NT_HOST}"* ]]; then
|
||||||
PH_CMD="ssh root@localhost"
|
PH_CMD="ssh root@localhost"
|
||||||
else
|
else
|
||||||
PH_CMD="ssh root@${!NT_HOST}"
|
PH_CMD="ssh root@${!NT_HOST}"
|
||||||
@@ -520,7 +493,7 @@ SERVICE(){
|
|||||||
for nip in "${var2[@]}"; do
|
for nip in "${var2[@]}"; do
|
||||||
|
|
||||||
|
|
||||||
# if [[ "${MIP}" == *"${3}"* ]]; then GO=true;
|
# if [[ "${RUN_NODE_IP}" == *"${3}"* ]]; then GO=true;
|
||||||
# elif [ ! -z ${3+x} ] || [ "${3}" == "q" ]; then GO=true;
|
# elif [ ! -z ${3+x} ] || [ "${3}" == "q" ]; then GO=true;
|
||||||
# else GO=false;
|
# else GO=false;
|
||||||
# fi
|
# fi
|
||||||
@@ -530,7 +503,7 @@ SERVICE(){
|
|||||||
else
|
else
|
||||||
nodename="${NM_HOSTNAMES[${nip}]}[${nip}]"
|
nodename="${NM_HOSTNAMES[${nip}]}[${nip}]"
|
||||||
fi
|
fi
|
||||||
if [[ "${MIP}" == *"${nip}"* ]]; then
|
if [[ "${RUN_NODE_IP}" == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -592,7 +565,7 @@ HAPROXY-CONFIG() {
|
|||||||
if [[ " ${MYSQL_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
if [[ " ${MYSQL_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${MYSQL_HOSTS[@]}"; do
|
for nip in "${MYSQL_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -613,7 +586,7 @@ HAPROXY-CONFIG() {
|
|||||||
if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${WEB_HOSTS[@]}"; do
|
for nip in "${WEB_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -633,7 +606,7 @@ HAPROXY-CONFIG() {
|
|||||||
if [[ " ${LB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
if [[ " ${LB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${LB_HOSTS[@]}"; do
|
for nip in "${LB_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -724,7 +697,7 @@ KEEPALIVE-CONFIG() {
|
|||||||
if [[ " ${MYSQL_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then
|
if [[ " ${MYSQL_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${MYSQL_HOSTS[@]}"; do
|
for nip in "${MYSQL_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -745,7 +718,7 @@ KEEPALIVE-CONFIG() {
|
|||||||
if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then
|
if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${WEB_HOSTS[@]}"; do
|
for nip in "${WEB_HOSTS[@]}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
NCMD=''
|
NCMD=''
|
||||||
else
|
else
|
||||||
@@ -779,7 +752,7 @@ NODEUPDATE() {
|
|||||||
echo -e "${idsCL[LightGreen]}Updating All Nodes${idsCL[Default]}"
|
echo -e "${idsCL[LightGreen]}Updating All Nodes${idsCL[Default]}"
|
||||||
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
|
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
|
||||||
nmip=${NM_NODEMANAGER}
|
nmip=${NM_NODEMANAGER}
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nmip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nmip}"* ]]; then
|
||||||
nmip='localhost'
|
nmip='localhost'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -801,7 +774,7 @@ NODEUPDATE() {
|
|||||||
nid=1
|
nid=1
|
||||||
var=${NTYPE}_HOSTS[@]
|
var=${NTYPE}_HOSTS[@]
|
||||||
for nip in "${!var}"; do
|
for nip in "${!var}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||||
nip='localhost '
|
nip='localhost '
|
||||||
fi
|
fi
|
||||||
NCMD="ssh -tq root@${nip}"
|
NCMD="ssh -tq root@${nip}"
|
||||||
@@ -1017,7 +990,7 @@ RUN_COMMAND(){
|
|||||||
|
|
||||||
var=${NTYPE}_HOSTS[@]
|
var=${NTYPE}_HOSTS[@]
|
||||||
for nip in "${!var}"; do
|
for nip in "${!var}"; do
|
||||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
|
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
|
||||||
else NCMD="ssh root@${nip}"; LH=''
|
else NCMD="ssh root@${nip}"; LH=''
|
||||||
fi
|
fi
|
||||||
echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]}[${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYello]}${LH}${idsCL[Default]}"
|
echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]}[${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYello]}${LH}${idsCL[Default]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user