diff --git a/defaults.inc b/defaults.inc index b0c13413..d612d183 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='4.7.124-06212023' +VERS='4.7.125-06212023' # NODETYPES=WEB NODETYPES=LB,LPD,MM,MYSQL,NC,PW,WPD,WM,WEB @@ -41,9 +41,9 @@ WEB_NGINX_SITES='/mnt/web-data/nginx/sites-enabled' noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck ' CERT_DAEMON='/snap/bin/certbot' +SCRIPT=${FOLDER}/nodemgmt-scripts.sh FOLDER=/opt/idssys/nodemgmt TMPFOLDER=${FOLDER}/.tmp -SCRIPT=${FOLDER}/nodemgmt-scripts.sh LOGFOLDER=${FOLDER}/logs LOGFILE=${LOGFOLDER}/logfile @@ -62,7 +62,9 @@ LB_REPL_CHECK=( lb-data ) #NC_REPL_CHECK=(apache nextcloud-php nextcloud-data) #NC_REPL_CHECK=( ) - +declare -A NGINX_PATHS +NGINX_PATHS['LB']='/opt/lb-data/nginx' +NGINX_PATHS['WEB']='/mnt/web-data/nginx' declare -A NM_HOSTNAMES NM_HOSTNAMES['10.10.1.121']='Webserver-Node1' diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 33901d1b..c1f14120 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -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