Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-11 16:55:34 -06:00
parent b1a6f949b0
commit eef2a0c0b9

View File

@@ -511,39 +511,44 @@ DEL-SSL(){
DEL_SSL=${1}
fi
if [ ! -z ${DEL_SSL+x} ] && [ "${DEL_SSL}" != "" ]; then
echo -e "${idsCL[LightRed]}Deleting the SSL certificates for '${idsCL[Red]}${DEL_SSL}${idsCL[LightRed]}'...${idsCL[Default]}"
echo ""
if [ -d /etc/letsencrypt/live/${DEL_SSL} ]"; then
echo -e "${idsCL[LightRed]}Deleting the SSL certificates for '${idsCL[Red]}${DEL_SSL}${idsCL[LightRed]}'...${idsCL[Default]}"
echo ""
echo -en "${idsCL[LightRed]}Removing Files and Folders... ${idsCL[Default]}"
# rm -rf /etc/letsencrypt/archive/${DEL_SITE}
# rm -rf /etc/letsencrypt/live/${DEL_SITE}
# rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
echo ""
echo -en "${idsCL[LightYellow]}Waiting for certificate replication between the nodes... ${idsCL[Default]}"
checked=false
timeout=`date --date='2 minutes' +%s`
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
if ${NCMD} "[ -d /etc/letsencrypt/live/${DEL_SITE} ]"; then
tchecked+=false
else
tchecked+=''
echo -en "${idsCL[LightRed]}Removing Files and Folders... ${idsCL[Default]}"
rm -rf /etc/letsencrypt/archive/${DEL_SITE}
rm -rf /etc/letsencrypt/live/${DEL_SITE}
rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
echo ""
echo -en "${idsCL[LightYellow]}Waiting for certificate replication between the nodes... ${idsCL[Default]}"
checked=false
timeout=`date --date='2 minutes' +%s`
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
if ${NCMD} "[ -d /etc/letsencrypt/live/${DEL_SSL} ]"; then
tchecked+=false
else
tchecked+=''
fi
fi
done
checked=${tchecked}
if [ "`date +%s`" -gt "$timeout" ]; then
echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
timeout=true
break
fi
done
checked=${tchecked}
if [ "`date +%s`" -gt "$timeout" ]; then
echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
timeout=true
break
fi
done
else
echo -e "${idsCL[LightRed]}The SSL files folder for '${idsCL[Red]}${DEL_SSL}${idsCL[LightRed]}' could not be found.${idsCL[Default]}"
exit 1
fi
if [ "${timeout}" != "true" ]; then
echo -e "${idsCL[Green]}Completed${idsCL[Default]}"
fi