This commit is contained in:
2019-02-07 09:34:14 -06:00
parent 388180256f
commit e7a14361a3
2 changed files with 26 additions and 32 deletions

View File

@@ -79,7 +79,13 @@ DISP_HEADER(){
} }
DIVIDER(){ DIVIDER(){
echo -e "${idsCL[Yellow]}-----------------------------------------------------------------------${idsCL[Default]}" if [ -z "$2" ]; then
clr='Yellow'
else
clr=$2
fi
}
echo -e "${idsCL[${clr}]}-----------------------------------------------------------------------${idsCL[Default]}"
if [ "$1" = true ]; then if [ "$1" = true ]; then
echo "" echo ""
fi fi

View File

@@ -53,39 +53,27 @@ STATUS() {
done done
nid=`expr $nid + 1` nid=`expr $nid + 1`
done done
echo echo
echo -e "${idsCL[Yellow]} Replication Status${idsCL[Default]}" echo -e "${idsCL[Yellow]} Replication Status${idsCL[Default]}"
DIVIDER DIVIDER true
checked=false
timeout=`date --date='2 minutes' +%s` timeout=`date --date='2 minutes' +%s`
until [ "${checked}" = "" ]; do nid=1
tchecked='' for nip in "${NODE_HOSTS[@]}"
for nip in "${NODE_HOSTS[@]}"; do do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD='' if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
else NCMD="ssh root@${nip}" echo -e "Node hostname: ${idsST[Bold]}${idsCL[LightCyan]}iDS-Node${nid} (${nip})${idsST[Reset]}${idsCL[Default]}"
fi DIVIDER false green
if [ "${NCMD}" != "" ]; then
tchecked+=`${NCMD} "cat /etc/letsencrypt/cert-renewal.lastrun" | diff - /etc/letsencrypt/cert-renewal.lastrun`
fi
done
checked=${tchecked}
if [ "`date +%s`" -gt "$timeout" ]; then
echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
timeout=true
echo "Timeout occured in waiting for replication between nodes." | mail -s "Cert-Renewal" ${STATUS_CHECK_EMAIL}
break
fi fi
nid=`expr $nid + 1`
done done
if [ "${timeout}" != "true" ]; then
echo -e "${idsCL[Green]}Completed${idsCL[Default]}"
fi
echo "" echo ""
if [ -z $action ] || [ "${action}" = "gui" ]; then if [ -z $action ] || [ "${action}" = "gui" ]; then
@@ -176,7 +164,7 @@ NEWCERT(){
# if [ "`date +%s`" -gt "$timeout" ]; then # if [ "`date +%s`" -gt "$timeout" ]; then
# echo -e "${idsCL[Red]}Timeout${idsCL[Default]}" # echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
# timeout=true # timeout=true
# echo "Timeout occured in waiting for replication between nodes. (${NEW_CERT})" | mail -s "Cert-Request" ${STATUS_CHECK_EMAIL} # echo "Timeout occurred in waiting for replication between nodes. (${NEW_CERT})" | mail -s "Cert-Request" ${STATUS_CHECK_EMAIL}
# break # break
# fi # fi
# done # done
@@ -230,7 +218,7 @@ CERTRENEW(){
if [ "`date +%s`" -gt "$timeout" ]; then if [ "`date +%s`" -gt "$timeout" ]; then
echo -e "${idsCL[Red]}Timeout${idsCL[Default]}" echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
timeout=true timeout=true
echo "Timeout occured in waiting for replication between nodes." | mail -s "Cert-Renewal" ${STATUS_CHECK_EMAIL} echo "Timeout occurred in waiting for replication between nodes." | mail -s "Cert-Renewal" ${STATUS_CHECK_EMAIL}
break break
fi fi
done done
@@ -268,7 +256,7 @@ NIGHTLYRENEW(){
done done
checked=${tchecked} checked=${tchecked}
if [ "`date +%s`" -gt "$timeout" ]; then if [ "`date +%s`" -gt "$timeout" ]; then
echo "Timeout occured in waiting for replication between nodes." | mail -s "Nightly-Cert-Renewal" ${STATUS_CHECK_EMAIL} echo "Timeout occurred in waiting for replication between nodes." | mail -s "Nightly-Cert-Renewal" ${STATUS_CHECK_EMAIL}
break break
fi fi
done done