Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-06 20:43:00 -06:00
parent dc842d93a2
commit aa5a8ee3f9

View File

@@ -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
}