update
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERS='4.6.11-04302023'
|
VERS='4.6.12-04302023'
|
||||||
|
|
||||||
#NODETYPES=WEB,LB
|
#NODETYPES=WEB,LB
|
||||||
NODETYPES=MYSQL,LB,WEB,NC,WPD,LPD,MM,PW
|
NODETYPES=MYSQL,LB,WEB,NC,WPD,LPD,MM,PW
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ STATUS(){
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
replstart=`date +%s`
|
# replstart=`date +%s`
|
||||||
if [ "${ST_ACTION}" != "check" ]; then
|
if [ "${ST_ACTION}" != "check" ]; then
|
||||||
echo -e "${idsCL[Green]}Complete${idsCL[Default]}"
|
echo -e "${idsCL[Green]}Complete${idsCL[Default]}"
|
||||||
echo
|
echo
|
||||||
@@ -413,8 +413,8 @@ STATUS(){
|
|||||||
echo -e "${idsCL[Yellow]} Replication Status Between the Primary and Secondary Nodes${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]} Replication Status Between the Primary and Secondary Nodes${idsCL[Default]}"
|
||||||
DIVIDER; echo -e "${idsST[Reset]}"
|
DIVIDER; echo -e "${idsST[Reset]}"
|
||||||
fi
|
fi
|
||||||
replcheckstart=`date +%s`
|
# replcheckstart=`date +%s`
|
||||||
echo "$(date) - STARTING REPL CHECK - $(SHOW_TIME $(expr `date +%s` - $replstart) s)" >> ${FOLDER}/log.repl
|
# echo "$(date) - STARTING REPL CHECK - $(SHOW_TIME $(expr `date +%s` - $replstart) s)" >> ${FOLDER}/log.repl
|
||||||
for NTYPE in "${NODE_TYPES[@]}"; do
|
for NTYPE in "${NODE_TYPES[@]}"; do
|
||||||
PH=${NTYPE}_HOSTS[0]
|
PH=${NTYPE}_HOSTS[0]
|
||||||
PH_CMD="ssh root@${!PH}"
|
PH_CMD="ssh root@${!PH}"
|
||||||
@@ -440,30 +440,16 @@ STATUS(){
|
|||||||
# timeout=`date --date='20 seconds' +%s`
|
# timeout=`date --date='20 seconds' +%s`
|
||||||
for rcheck in "${!var2}"; do
|
for rcheck in "${!var2}"; do
|
||||||
if [ "${ST_ACTION}" != "check" ]; then
|
if [ "${ST_ACTION}" != "check" ]; then
|
||||||
if [ "${ST_ACTION}" != "report" ]; then
|
[ "${ST_ACTION}" != "report" ] && c=0; cw=30; spc=''; spc1=${cw}-${#REPL_DESC[${rcheck}]}; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done || spc=' '
|
||||||
c=0; cw=30; spc=''
|
|
||||||
spc1=${cw}-${#REPL_DESC[${rcheck}]}
|
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
|
||||||
else
|
|
||||||
spc=' '
|
|
||||||
fi
|
|
||||||
echo -en " ${REPL_DESC[${rcheck}]}${spc}: "
|
echo -en " ${REPL_DESC[${rcheck}]}${spc}: "
|
||||||
|
|
||||||
timeout=`date --date='2 minutes' +%s`
|
timeout=`date --date='2 minutes' +%s`
|
||||||
|
warn_timeout=`date --date='30 secs' +%s`
|
||||||
# if [ "${rcheck}" == "www" ]; then
|
|
||||||
# timeout=`date --date='2 minutes' +%s`
|
|
||||||
# else
|
|
||||||
# timeout=`date --date='20 seconds' +%s`
|
|
||||||
# fi
|
|
||||||
|
|
||||||
else
|
else
|
||||||
timeout=`date --date='2 minutes' +%s`
|
timeout=`date --date='2 minutes' +%s`
|
||||||
fi
|
fi
|
||||||
warn_timeout=`date --date='30 secs' +%s`
|
|
||||||
|
|
||||||
checked=false
|
checked=false
|
||||||
replnodestart=`date +%s`
|
# replnodestart=`date +%s`
|
||||||
until [ "${checked}" = "" ]; do
|
until [ "${checked}" = "" ]; do
|
||||||
if [ "${PH_CMD}" = "" ]; then
|
if [ "${PH_CMD}" = "" ]; then
|
||||||
ssh -q root@${nip} [[ -f ${REPL_CHECKS[${rcheck}]}/test.repl ]] && checked=`ssh root@${nip} "cat ${REPL_CHECKS[${rcheck}]}/test.repl" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl`
|
ssh -q root@${nip} [[ -f ${REPL_CHECKS[${rcheck}]}/test.repl ]] && checked=`ssh root@${nip} "cat ${REPL_CHECKS[${rcheck}]}/test.repl" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl`
|
||||||
@@ -473,36 +459,32 @@ STATUS(){
|
|||||||
if [ "`date +%s`" -gt "${timeout}" ]; then
|
if [ "`date +%s`" -gt "${timeout}" ]; then
|
||||||
timeout=true
|
timeout=true
|
||||||
break
|
break
|
||||||
elif [ "`date +%s`" -gt "${warn_timeout}" ]; then
|
elif [ "`date +%s`" -gt "${warn_timeout}" ] && [ "${ST_ACTION}" != "report" ]; then
|
||||||
echo -en " waiting for sync... "
|
echo -en " waiting for sync... "
|
||||||
warn_timeout=`date --date='100 minutes' +%s`
|
warn_timeout=`date --date='100 minutes' +%s`
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
replend=`date +%s`
|
# replend=`date +%s`
|
||||||
replruntime=$((replend-replstart))
|
# replruntime=$((replend-replstart))
|
||||||
replnoderuntime=$((replend-replnodestart))
|
# replnoderuntime=$((replend-replnodestart))
|
||||||
replcheckruntime=$((replend-replcheckstart))
|
# replcheckruntime=$((replend-replcheckstart))
|
||||||
rrmsg="$(SHOW_TIME ${replruntime} s) (copy) $(SHOW_TIME ${replcheckruntime} s) (start) $(SHOW_TIME ${replnoderuntime} s) (node)"
|
# rrmsg="$(SHOW_TIME ${replruntime} s) (copy) $(SHOW_TIME ${replcheckruntime} s) (start) $(SHOW_TIME ${replnoderuntime} s) (node)"
|
||||||
if [ "${timeout}" = "true" ]; then
|
if [ "${timeout}" = "true" ]; then
|
||||||
if [ "${ST_ACTION}" != "check" ]; then
|
[ "${ST_ACTION}" != "check" ] && echo -e "${idsCL[Red]}Timeout${idsCL[Default]} - ${rrmsg}"
|
||||||
echo -e "${idsCL[Red]}Timeout${idsCL[Default]} - ${rrmsg}"
|
|
||||||
fi
|
|
||||||
if [ ! -f ${FOLDER}/${nip}-${rcheck}.down ]; then
|
if [ ! -f ${FOLDER}/${nip}-${rcheck}.down ]; then
|
||||||
touch ${FOLDER}/${nip}-${rcheck}.down
|
touch ${FOLDER}/${nip}-${rcheck}.down
|
||||||
SENDNOTICE "Repl-Timeout-'${NM_NODETYPES[$NTYPE]}-Node${nid}'" "${REPL_DESC[${rcheck}]} (${REPL_CHECKS[${rcheck}]})" 1
|
SENDNOTICE "Repl-Timeout-'${NM_NODETYPES[$NTYPE]}-Node${nid}'" "${REPL_DESC[${rcheck}]} (${REPL_CHECKS[${rcheck}]})" 1
|
||||||
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - (${REPL_DESC[${rcheck}]}) Replicated folder timeout, it is not syncing" >> ${LOGFILE}
|
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - (${REPL_DESC[${rcheck}]}) Replicated folder timeout, it is not syncing" >> ${LOGFILE}
|
||||||
fi
|
fi
|
||||||
echo "$(date) - TIMEOUT - ${rcheck} - ${rrmsg}" >> ${FOLDER}/log.repl
|
# echo "$(date) - TIMEOUT - ${rcheck} - ${rrmsg}" >> ${FOLDER}/log.repl
|
||||||
else
|
else
|
||||||
if [ "${ST_ACTION}" != "check" ]; then
|
[ "${ST_ACTION}" != "check" ] && echo -e "${idsCL[Green]}Good${idsCL[Default]} - ${rrmsg}"
|
||||||
echo -e "${idsCL[Green]}Good${idsCL[Default]} - ${rrmsg}"
|
|
||||||
fi
|
|
||||||
if [ -f ${FOLDER}/${nip}-${rcheck}.down ]; then
|
if [ -f ${FOLDER}/${nip}-${rcheck}.down ]; then
|
||||||
rm -f ${FOLDER}/${nip}-${rcheck}.down
|
rm -f ${FOLDER}/${nip}-${rcheck}.down
|
||||||
SENDNOTICE "Repl-Timeout-'${NM_NODETYPES[$NTYPE]}-Node${nid}'" "Replicated folder is back up!\n${REPL_DESC[${rcheck}]} (${REPL_CHECKS[${rcheck}]})"
|
SENDNOTICE "Repl-Timeout-'${NM_NODETYPES[$NTYPE]}-Node${nid}'" "Replicated folder is back up!\n${REPL_DESC[${rcheck}]} (${REPL_CHECKS[${rcheck}]})"
|
||||||
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - (${REPL_DESC[${rcheck}]}) Replicated folder is back up" >> ${LOGFILE}
|
echo "$(date) - ${nip} - ${NM_NODETYPES[$NTYPE]}-Node${nid} - (${REPL_DESC[${rcheck}]}) Replicated folder is back up" >> ${LOGFILE}
|
||||||
fi
|
fi
|
||||||
echo "$(date) - SYNCED - ${rcheck} - ${rrmsg}" >> ${FOLDER}/log.repl
|
# echo "$(date) - SYNCED - ${rcheck} - ${rrmsg}" >> ${FOLDER}/log.repl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user