From 68ef5a7b353c4f2b8909d2ab39fec57901ae9803 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 10 May 2025 11:11:22 -0500 Subject: [PATCH] Update status.inc --- inc/status.inc | 52 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/inc/status.inc b/inc/status.inc index 486d6ca3..a7f49471 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -54,23 +54,35 @@ STATUS(){ c=0; cw=${LD_CW}; spc=''; spc1=${cw}-${#MSG}; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -en "${idsCL[LightCyan]}${MSG}${spc}: " fi + for NTYPE in "${ntypesel[@]}"; do PH=${NTYPE}_HOSTS[0] - PH_CMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${!PH}" - var=${NTYPE}_REPL_CHECK[@] - if [ ! -z ${!var+x} ]; then - var=${NTYPE}_HOSTS[@] - for nip in "${!var}"; do - if [[ "${RUN_NODE_IP}" != *"${nip}"* ]] && [ "${nip}" != "${!PH}" ]; then - if [ ! -f ${NM_FOLDER}/${!PH}.down ] && [ ! -f ${NM_TMPFOLDER}/${nip}.down ]; then - var2=${NTYPE}_REPL_CHECK[@] - for rcheck in "${!var2}"; do - until [ $(ls ${STATUSRUN_TMPFOLDER}/repl.*.running 2>/dev/null | wc -l) -lt ${SCAN_THREADS} ]; do tmp=tmp; done - REPLCHECK "${rcheck}" "${nip}" "${PH_CMD}" "${STATUS_ACTION}" & >/dev/null 2>&1 - done + skip=0 + if [ -f ${NM_TMPFOLDER}/${!PH}.disable ] || [ -f ${NM_TMPFOLDER}/${!PH}.down ]; then + if [ $(eval echo \${#${PHA}[@]}) -eq 2 ]; then + skip=1 + else + PH=${NODETYPE}_HOSTS[1] + fi + fi + + if [ ${skip} -eq 0 ]; then + PH_CMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${!PH}" + var=${NTYPE}_REPL_CHECK[@] + if [ ! -z ${!var+x} ]; then + var=${NTYPE}_HOSTS[@] + for nip in "${!var}"; do + if [[ "${RUN_NODE_IP}" != *"${nip}"* ]] && [ "${nip}" != "${!PH}" ] && [ ! -f ${NM_TMPFOLDER}/${!PH}.disable ] && [ ! -f ${NM_TMPFOLDER}/${!PH}.down ]; then + if [ ! -f ${NM_FOLDER}/${!PH}.down ] && [ ! -f ${NM_TMPFOLDER}/${nip}.down ]; then + var2=${NTYPE}_REPL_CHECK[@] + for rcheck in "${!var2}"; do + until [ $(ls ${STATUSRUN_TMPFOLDER}/repl.*.running 2>/dev/null | wc -l) -lt ${SCAN_THREADS} ]; do tmp=tmp; done + REPLCHECK "${rcheck}" "${nip}" "${PH_CMD}" "${STATUS_ACTION}" & >/dev/null 2>&1 + done + fi fi - fi - done + done + fi fi done [ "${STATUS_ACTION}" != "check" ] && echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}" @@ -901,7 +913,17 @@ REPLCHECK(){ REPLSTART(){ NODETYPE=${1} PH=${NODETYPE}_HOSTS[0] - if [ ! -f ${NM_FOLDER}/${!PH}.down ]; then + PHA=${NODETYPE}_HOSTS + skip=0 + if [ -f ${NM_TMPFOLDER}/${!PH}.disable ] || [ -f ${NM_TMPFOLDER}/${!PH}.down ]; then + if [ $(eval echo \${#${PHA}[@]}) -eq 2 ]; then + skip=1 + else + PH=${NODETYPE}_HOSTS[1] + fi + fi + + if [ ${skip} -eq 0 ]; then PH_CMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${!PH}" var=${NODETYPE}_REPL_CHECK[@] if [ ! -z ${!var+x} ]; then