update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERS='4.6.50-05132023'
|
||||
VERS='4.6.55-05132023'
|
||||
|
||||
# NODETYPES=LB
|
||||
NODETYPES=MYSQL,LB,WEB,NC,WPD,LPD,MM,PW
|
||||
|
||||
@@ -360,13 +360,16 @@ SERVICES(){
|
||||
}
|
||||
|
||||
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[@]
|
||||
|
||||
if [ "$1" = "glusterd" ]; then
|
||||
|
||||
for nip in "${GL_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 [[ "${MIP}" == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
@@ -402,7 +405,7 @@ SERVICE(){
|
||||
sleep 5s
|
||||
|
||||
for nip in "${GL_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 [[ "${MIP}" == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
@@ -450,42 +453,29 @@ SERVICE(){
|
||||
|
||||
else
|
||||
if [ "${4}" != "all" ]; then
|
||||
IP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
||||
echo "IP: ${IP}"
|
||||
for NTYPE in "${NODE_TYPES[@]}"; do
|
||||
var=${NTYPE}_HOSTS[@]
|
||||
NODE_TYPE=""
|
||||
for nip in "${!var}"; do
|
||||
echo "$IP - $nip"
|
||||
if [[ "${IP}" == *"${nip}"* ]]; then
|
||||
if [[ "${MIP}" == *"${nip}"* ]]; then
|
||||
NODE_TYPE=${NTYPE};
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "NODETYPE: ${NODE_TYPE}"
|
||||
|
||||
if [ "${NODE_TYPE}" == "" ]; then
|
||||
TSI=$(/sbin/ip link | grep tailscale0)
|
||||
TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1)
|
||||
echo "TSIP: ${TSIP}"
|
||||
if [ ${#TSI} != 0 ]; then
|
||||
for NTYPE in "${NODE_TYPES[@]}"; do
|
||||
var=${NTYPE}_HOSTS[@]
|
||||
for nip in "${!var}"; do
|
||||
echo "${TSIP} - $nip"
|
||||
if [[ "${TSIP}" == *"${nip}"* ]]; then
|
||||
NODE_TYPE=${NTYPE};
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${NODE_TYPE}" == "" ] && [ ${#TSI} != 0 ]; then
|
||||
for NTYPE in "${NODE_TYPES[@]}"; do
|
||||
var=${NTYPE}_HOSTS[@]
|
||||
for nip in "${!var}"; do
|
||||
if [[ "${TSIP}" == *"${nip}"* ]]; then
|
||||
NODE_TYPE=${NTYPE};
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "NODETYPE: ${NODE_TYPE}"
|
||||
|
||||
|
||||
if [ "${NODE_TYPE}" != "" ]; then
|
||||
NT_HOSTS=${NODE_TYPE}_HOSTS[@]
|
||||
NT_HOST=${NODE_TYPE}_HOSTS[0]
|
||||
@@ -525,7 +515,7 @@ SERVICE(){
|
||||
if [ "${3}" != "q" ]; then
|
||||
echo -en "${idsCL[LightYellow]}Verifying nginx config and ssl cert replication across the nodes... ${idsCL[Default]}"
|
||||
fi
|
||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${!NT_HOST}"* ]]; then
|
||||
if [[ "${MIP}" == *"${!NT_HOST}"* ]]; then
|
||||
PH_CMD="ssh root@localhost"
|
||||
else
|
||||
PH_CMD="ssh root@${!NT_HOST}"
|
||||
@@ -559,7 +549,7 @@ SERVICE(){
|
||||
if [ "${3}" != "q" ]; then
|
||||
echo -en "${idsCL[LightYellow]}Verifying Apache config and ssl cert replication across the nodes... ${idsCL[Default]}"
|
||||
fi
|
||||
if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${!NT_HOST}"* ]]; then
|
||||
if [[ "${MIP}" == *"${!NT_HOST}"* ]]; then
|
||||
PH_CMD="ssh root@localhost"
|
||||
else
|
||||
PH_CMD="ssh root@${!NT_HOST}"
|
||||
@@ -603,7 +593,9 @@ SERVICE(){
|
||||
fi
|
||||
|
||||
for nip in "${var2[@]}"; do
|
||||
# if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${3}"* ]]; then GO=true;
|
||||
|
||||
|
||||
# if [[ "${MIP}" == *"${3}"* ]]; then GO=true;
|
||||
# elif [ ! -z ${3+x} ] || [ "${3}" == "q" ]; then GO=true;
|
||||
# else GO=false;
|
||||
# fi
|
||||
@@ -613,7 +605,7 @@ SERVICE(){
|
||||
else
|
||||
nodename="${NM_NODETYPES[$NTYPE]}-Node${nid}"
|
||||
fi
|
||||
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 [[ "${MIP}" == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user