Update nodemgmt-scripts.sh

This commit is contained in:
2019-11-23 19:21:08 -06:00
parent 3fe0059f80
commit 95213fe90c

View File

@@ -1153,6 +1153,23 @@ SERVICES(){
}
SERVICE(){
NODE_TYPE=''
var=NC_HOSTS[@]
for nip in "${!var}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
NODE_TYPE='NC';
fi
done
if [ "$NODE_TYPE" = "NC" ]; then
NT_HOSTS=NC_HOSTS[@]
NT_HOST=NC_HOSTS[0]
NTS=('NC')
else
NT_HOSTS=WEB_HOSTS[@]
NT_HOST=WEB_HOSTS[0]
NTS=NODE_TYPES[@]
fi
if [ "${3}" != "q" ]; then
if [ "${NM_SERVICES[${1}]}" = "" ]; then
echo -e "${idsCL[Red]}(${1}) is not an allowed service.${idsCL[Default]}"
@@ -1180,13 +1197,13 @@ SERVICE(){
if [ "${3}" != "q" ]; then
echo -en "${idsCL[LightYellow]}Verifying nginx config and ssl cert replication across the nodes... ${idsCL[Default]}"
fi
PH_CMD="ssh root@${WEB_HOSTS[0]}"
PH_CMD="ssh root@${!NT_HOST}"
${PH_CMD} "echo -e \"Service ${1} ${2}\" > /etc/nginx/test.repl"
${PH_CMD} "echo -e \"Service ${1} ${2}\" > /etc/letsencrypt/test.repl"
for nip in "${WEB_HOSTS[@]}"; do
for nip in "${!NT_HOSTS}"; do
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then
if [ "${nip}" != "${WEB_HOSTS[0]}" ]; then
if [ "${nip}" != "${!NT_HOST}" ]; then
checked=false
until [ "${checked}" = "" ]; do
checked="`${PH_CMD} \"ssh root@${nip} \"cat /etc/nginx/test.repl\" | diff - /etc/nginx/test.repl\"`"
@@ -1205,7 +1222,7 @@ SERVICE(){
echo
fi
for NTYPE in "${NODE_TYPES[@]}"; do
for NTYPE in "${!NTS}"; do
var1=${NTYPE}SERVICES_CHECK
if [[ "${!var1}" = *"${1}"* ]]; then
nid=1