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