This commit is contained in:
2023-06-23 18:15:07 -05:00
parent 71f7563d07
commit e186e1026a
2 changed files with 11 additions and 12 deletions

View File

@@ -509,35 +509,32 @@ SERVICE(){
fi
if [ "${1}" = "nginx" ] && [ "${NODE_TYPE}" == "LB" ]; then
if [ "${1}" = "nginx" ] && [ "${NGINX_PATHS[${NODE_TYPE}]}" != "" ]; then
if [ "${2}" = "restart" ] || [ "${2}" = "reload" ]; then
if [ "${3}" != "ns" ]; then
if [ "${3}" != "q" ]; then
echo -en "${idsCL[LightYellow]}Verifying nginx config and ssl cert replication across the nodes... ${idsCL[Default]}"
echo -en "${idsCL[LightYellow]}Verifying replication across the nodes... ${idsCL[Default]}"
fi
if [[ "${MIP}" == *"${!NT_HOST}"* ]]; then
PH_CMD=""
else
PH_CMD="ssh root@${!NT_HOST}"
fi
${PH_CMD} touch /opt/lb-data/nginx/test.repl
# ${PH_CMD} "echo -e \"Service ${1} ${2}\" >> /opt/lb-data/nginx/test.repl"
${PH_CMD} touch ${NGINX_PATHS[${NODE_TYPE}]}/test.repl
# ${PH_CMD} "echo -e \"Service ${1} ${2}\" >> ${NGINX_PATHS[${NODE_TYPE}]}/test.repl"
for nip in "${!NT_HOSTS}"; do
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then
if [ "${nip}" != "${!NT_HOST}" ]; then
checked=false
until [ "${checked}" = "" ]; do
checked="`${PH_CMD} \"ssh root@${nip} '[ -f /opt/lb-data/nginx/test.repl ] && cat -u /opt/lb-data/nginx/test.repl' | diff -q - /opt/lb-data/nginx/test.repl\"`"
checked="`${PH_CMD} \"ssh root@${nip} '[ -f ${NGINX_PATHS[${NODE_TYPE}]}/test.repl ] && cat -u ${NGINX_PATHS[${NODE_TYPE}]}/test.repl' | diff -q - ${NGINX_PATHS[${NODE_TYPE}]}/test.repl\"`"
# checked="`${PH_CMD} \"ssh root@${nip} 'if [ -f /etc/nginx/test.repl ]; then cat /etc/letsencrypt/test.repl; fi' | diff - /etc/letsencrypt/test.repl\"`"
done
fi
fi
done
${PH_CMD} rm -f /opt/lb-data/nginx/test.repl
# if [ "$NODE_TYPE" != "NC" ]; then
# ${PH_CMD} rm -f /etc/letsencrypt/test.repl
# fi
${PH_CMD} rm -f ${NGINX_PATHS[${NODE_TYPE}]}/test.repl
fi
fi