Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-07 10:53:44 -06:00
parent 5b01bb468e
commit 36abef2b9d

View File

@@ -110,12 +110,6 @@ STATUS() {
nid=`expr $nid + 1`
done
echo ""
if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true
@@ -125,6 +119,16 @@ STATUS() {
STATUS-CHECK(){
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
for nip in "${NODE_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
for rcheck in "${REPL_CHECK[@]}"; do
rm -f ${FOLDER}/test.repl
daterun=`date +%Y-%m-%d-%H-%M`
echo -e "iDS-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl
yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl
done
fi
done
if [ ! -z ${LOCAL_SERVICES+x} ]; then
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1)
for srvc in "${LOCAL_SERVICES[@]}"
@@ -158,6 +162,25 @@ STATUS-CHECK(){
nid=`expr $nid + 1`
done
fi
#REPLICATION CHECK
timeout=`date --date='30 seconds' +%s`
for nip in "${NODE_HOSTS[@]}"
do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
for rcheck in "${REPL_CHECK[@]}"
do
checked=false
until [ "${checked}" = "" ]; do
checked=`ssh root@${nip} "cat ${REPL_CHECKS[${rcheck}]}/test.repl" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl`
if [ "`date +%s`" -gt "$timeout" ]; then
echo "Timeout occurred in waiting for replication between nodes." | mail -s "Status-Check" ${STATUS_CHECK_EMAIL}
timeout=true
break
fi
done
done
fi
done
fi
}