This commit is contained in:
2024-01-11 11:07:37 -06:00
parent 18aa6ce61d
commit c24fb6debe
6 changed files with 113 additions and 86 deletions

View File

@@ -54,7 +54,7 @@ STATUS(){
fi
for NTYPE in "${ntypesel[@]}"; do
PH=${NTYPE}_HOSTS[0]
PH_CMD="ssh root@${!PH}"
PH_CMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${!PH}"
var=${NTYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
var=${NTYPE}_HOSTS[@]
@@ -211,7 +211,7 @@ STATUS(){
for NTYPE in "${ntypesel[@]}"; do
PH=${NTYPE}_HOSTS[0]
PH_CMD="ssh root@${!PH}"
PH_CMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${!PH}"
var=${NTYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
var=${NTYPE}_HOSTS[@]
@@ -273,7 +273,7 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
fi
rm -f ${NM_TMPFOLDER}/${nip}~${rcheck}.repl*
fi
ssh -q root@${nip} 'find ${NM_REPL_CHECK_LOC[${rcheck}]} -iname "*.sync-conflict-*" -exec rm {} \;'
ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} 'find ${NM_REPL_CHECK_LOC[${rcheck}]} -iname "*.sync-conflict-*" -exec rm {} \;' &
fi
done
@@ -298,24 +298,51 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
for NTYPE in "${ntypesel[@]}"; do
PH=${NTYPE}_HOSTS[0]
if [ ! -f ${NM_FOLDER}/${!PH}.down ]; then
PH_CMD="ssh root@${!PH}"
PH_CMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${!PH}"
var=${NTYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
for rcheck in "${!var}"; do
if [ "${PH_CMD}" == "" ]; then
rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
if [ "${PH_CMD}" == "" ]; then
rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
for rcheck in "${!var}"; do
rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl &
else
${PH_CMD} rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
done
else
${PH_CMD} rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
for rcheck in "${!var}"; do
${PH_CMD} rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl &
fi
done
done
fi
fi
fi
done
rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl
touch ${NM_TMPFOLDER}/.replcheck
[ "${STATUS_ACTION}" != "check" ] && echo -e "${idsCL[LightGreen]}Complete${idsCL[Default]}\n"
if [ ! -f ${NM_TMPFOLDER}/.replclean ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.replclean)) -ge 10800 ]; then
for NTYPE in "${ntypesel[@]}"; do
echo "${NTYPE} Nodes ---"
PH=${NTYPE}_HOSTS[0]
if [ ! -f ${NM_FOLDER}/${!PH}.down ]; then
PH_CMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${!PH}"
var=${NTYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
for rcheck in "${!var}"; do
echo "${rcheck} folder"
if [ $(${PH_CMD} 'ls ${NM_REPL_CHECK_LOC[${rcheck}]}/test.*.repl 2>/dev/null | wc -l') -gt 0 ]; then
for replfile in $(${PH_CMD} ${NM_REPL_CHECK_LOC[${rcheck}]}/test.*.repl); do
echo -en "${replfile} : "
[ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.replclean)) -ge 1200 ] echo "Removing" || echo "Not Removing"
done
# rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl &
fi
done
fi
fi
echo
done
# touch ${NM_TMPFOLDER}/.replclean
fi
fi
########################
@@ -332,7 +359,7 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
var=${NTYPE}_HOSTS[@]
for nip in "${!var}"; do
if [[ $"{RNIP}" == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
else NCMD="ssh -o ConnectTimeout=3 root@${nip}"; LH=''
else NCMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip}"; LH=''
fi
if [ "${STATUS_ACTION}" != "check" ]; then
echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]} [${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYellow]}${LH}${idsCL[Default]}"
@@ -341,7 +368,7 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
[ "${STATUS_ACTION}" != "check" ] && [ "${2}" != "report" ] && echo -en " ${idsCL[LightCyan]}Getting drives from server ... ${idsCL[Default]}"
declare -A partitions
DRIVEINFO=$(ssh -o ConnectTimeout=3 root@${nip} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|shm|mmcblk|overlay|-volume|Music|Software' | awk '{ print $1 " " $2 " " $4 }')
DRIVEINFO=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|shm|mmcblk|overlay|-volume|Music|Software' | awk '{ print $1 " " $2 " " $4 }')
DRIVEINFO=(${DRIVEINFO})
if [ "${2}" != "report" ]; then
echo -en "\e[1A"
@@ -432,7 +459,7 @@ STATUS_NODE(){
if [[ "${RUN_NODE_IP}" == *"${nip}"* ]]; then
NCMD=''; LH='- localhost'
else
NCMD="ssh -o ConnectTimeout=3 root@${nip}"; LH=''
NCMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip}"; LH=''
fi
if [ "${NCMD}" != "" ]; then
checkhost=$(CHECK_HOST ${nip})
@@ -563,7 +590,7 @@ STATUS_NODE(){
mysqlgo=true
fi
else
if [ "$(ssh -o ConnectTimeout=3 root@${nip} ps -U root | grep "offsite-power-check.sh start" | grep -v "grep" | awk '{print $1}')" != "" ]; then
if [ "$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} ps -U root | grep "offsite-power-check.sh start" | grep -v "grep" | awk '{print $1}')" != "" ]; then
srvctest=active
else
srvctest=notactive
@@ -794,9 +821,9 @@ REPLCHECK(){
checked=false
until [ "${checked}" == "" ]; do
if [ "${PH_CMD}" == "" ]; then
ssh -q root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl ]] && checked=`ssh -o ConnectTimeout=3 root@${nip} "cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl`
ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl ]] && checked=`ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} "cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl`
else
ssh -q root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl ]] && checked="`${PH_CMD} \"ssh -o ConnectTimeout=3 root@${nip} \"cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl\" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl\"`"
ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl ]] && checked="`${PH_CMD} \"ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} \"cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl\" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl\"`"
fi
if [ "`date +%s`" -gt "${timeout}" ]; then
timeout=true
@@ -810,7 +837,7 @@ REPLSTART(){
NODETYPE=${1}
PH=${NODETYPE}_HOSTS[0]
if [ ! -f ${NM_FOLDER}/${!PH}.down ]; then
PH_CMD="ssh root@${!PH}"
PH_CMD="ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${!PH}"
var=${NODETYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
for rcheck in "${!var}"; do