From aa5a8ee3f9de2a8f2c597d7fd03255eea63c9d04 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 6 Feb 2019 20:43:00 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index cf8f045a..86921775 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -79,6 +79,7 @@ NEWCERT(){ do_with_root chmod -R 6775 /etc/letsencrypt rm -f /etc/letsencrypt/cert-request.lastrun echo -e "${NEW_CERT}" > /etc/letsencrypt/cert-request.lastrun + DIVIDER true echo -en "${idsCL[LightYellow]}Waiting for certifcate replication between the nodes... ${idsCL[Default]}" checked=false until [ "${checked}" = "" ]; do @@ -121,30 +122,22 @@ CERTRENEW(){ do_with_root chown -R root:letsencrypt /etc/letsencrypt 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun do_with_root chmod -R 6775 /etc/letsencrypt 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun yes | cp -rfH /opt/idssys/nodemgmt/cert-renewal.lastrun /etc/letsencrypt/cert-renewal.lastrun + daterun=`date +%Y-%m-%d-%H-%M` + echo -e "${daterun}" >> /etc/letsencrypt/cert-renewal.lastrun + DIVIDER true echo -en "${idsCL[LightYellow]}Waiting for certifcate replication between the nodes... ${idsCL[Default]}" - - until [ "${synccomplete}" = "true" ]; do - synccomplete=true - for nip in "${NODE_HOSTS[@]}" - do + checked=false + until [ "${checked}" = "" ]; do + tchecked='' + for nip in "${NODE_HOSTS[@]}"; do if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD='' else NCMD="ssh root@${nip}" fi if [ "${NCMD}" != "" ]; then - check=`${NCMD} "cat /etc/letsencrypt/cert-renewal.lastrun" | diff - /etc/letsencrypt/cert-renewal.lastrun` - if [ "${check}" != "" ]; then - synccomplete=false - fi + tchecked+=`${NCMD} "cat /etc/letsencrypt/cert-request.lastrun" | diff - /etc/letsencrypt/cert-request.lastrun` fi done - - - #same1=`ssh root@10.5.10.52 "cat /etc/letsencrypt/cert-renewal.lastrun" | diff - /etc/letsencrypt/cert-renewal.lastrun` - #same2=`ssh root@10.5.10.53 "cat /etc/letsencrypt/cert-renewal.lastrun" | diff - /etc/letsencrypt/cert-renewal.lastrun` - #if [ "${same1}" = "" ] && [ "${same2}" = "" ] - # then same="true" - # else same="false" - #fi + checked=${tchecked} done SERVICE nginx reload 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun }