This commit is contained in:
2024-08-15 20:57:24 -05:00
parent a44755b713
commit d257a34c5f
3 changed files with 23 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='5.1.132-08142024'
VERS='5.1.133-08152024'
NM_BETA=false
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update log betacheck offsite-staticroute-fix '

View File

@@ -280,14 +280,14 @@ SERVICE_MGMT(){
else
PH_CMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${!NT_HOST}"
fi
${PH_CMD} touch ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl
# ${PH_CMD} "echo -e \"Service ${SERVICE['service']} ${SERVICE['action']}\" >> ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl"
${PH_CMD} touch ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/.test.repl
# ${PH_CMD} "echo -e \"Service ${SERVICE['service']} ${SERVICE['action']}\" >> ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/.test.repl"
for nip in "${!NT_HOSTS}"; do
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ] && [ "${nip}" != "${!NT_HOST}" ]; then
checked=false
until [ "${checked}" = "true" ]; do
checked="`${PH_CMD} ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} [ -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl)) -le 90 ] && echo true`"
checked="`${PH_CMD} ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} [ -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/.test.repl ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/.test.repl)) -le 90 ] && echo true`"
done
fi
done
@@ -297,12 +297,12 @@ SERVICE_MGMT(){
if [ "${checkhost}" != "false" ] && [ "${nip}" != "${!NT_HOST}" ]; then
unset checked1 checked2
until [ "${checked1}" = "true" ]; do
until [ "${checked2}" = "true" ]; do checked2="`${PH_CMD} [ -f ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/test.repl ] && echo true`"; sleep 1s; done
checked1="`${PH_CMD} [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/test.repl)) -le 90 ] && echo true`"
until [ "${checked2}" = "true" ]; do checked2="`${PH_CMD} [ -f ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/.test.repl ] && echo true`"; sleep 1s; done
checked1="`${PH_CMD} [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/.test.repl)) -le 90 ] && echo true`"
done
fi
done
${PH_CMD} rm -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/test.repl
${PH_CMD} rm -f ${NM_REPL_NGINX_PATHS[${RUN_NODE_TYPE}]}/.test.repl
fi
fi
elif ([ "${SERVICE['service']}" = "pdns" ] || [ "${SERVICE['service']}" = "pdnsadmin" ] || [ "${SERVICE['service']}" = "headscale" ]) && ([ "${SERVICE['node']}" == "" ] || [ "${SERVICE['node']}" == "ALL" ]); then
@@ -314,18 +314,18 @@ SERVICE_MGMT(){
else
PH_CMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${!NT_HOST}"
fi
${PH_CMD} touch ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/test.repl
${PH_CMD} touch ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/.test.repl
for nip in "${!NT_HOSTS}"; do
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ] && [ "${nip}" != "${!NT_HOST}" ]; then
unset checked1 checked2
until [ "${checked1}" = "true" ]; do
until [ "${checked2}" = "true" ]; do checked2="`${PH_CMD} [ -f ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/test.repl ] && echo true`"; sleep 1s; done
checked1="`${PH_CMD} [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/test.repl)) -le 90 ] && echo true`"
until [ "${checked2}" = "true" ]; do checked2="`${PH_CMD} [ -f ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/.test.repl ] && echo true`"; sleep 1s; done
checked1="`${PH_CMD} [ $(expr $(date +%s) - $(stat -L --format %Y ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/.test.repl)) -le 90 ] && echo true`"
done
fi
done
${PH_CMD} rm -f ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/test.repl
${PH_CMD} rm -f ${NM_REPL_CHECK_LOC[${SERVICE['service']}]}/.test.repl
fi
fi
fi

View File

@@ -313,14 +313,14 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
var=${NTYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
if [ "${PH_CMD}" == "" ]; then
rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
rm -f ${NM_FOLDER}/.test.${STATUS_START//-/}.repl &
for rcheck in "${!var}"; do
rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl &
rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.${STATUS_START//-/}.repl &
done
else
${PH_CMD} rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
${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 &
${PH_CMD} rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.${STATUS_START//-/}.repl &
done
fi
fi
@@ -335,9 +335,9 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
if [ ! -z ${!var+x} ]; then
PH_CMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${!PH}"
for rcheck in "${!var}"; do
${PH_CMD} rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.2023*.repl
if [ $(${PH_CMD} ls ${NM_REPL_CHECK_LOC[${rcheck}]}/test.*.repl 2>/dev/null | wc -l) -gt 0 ]; then
for replfile in $(${PH_CMD} ls ${NM_REPL_CHECK_LOC[${rcheck}]}/test.*.repl); do
${PH_CMD} rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.2023*.repl
if [ $(${PH_CMD} ls ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.*.repl 2>/dev/null | wc -l) -gt 0 ]; then
for replfile in $(${PH_CMD} ls ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.*.repl); do
[ $(expr $(date +%s) - $(${PH_CMD} stat -c %Y ${replfile})) -ge 1200 ] && ${PH_CMD} rm -f ${replfile} &
done
fi
@@ -348,7 +348,7 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
REPLRUN=2
touch ${NM_TMPFOLDER}/.replclean
fi
rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl
rm -f ${NM_FOLDER}/.test.${STATUS_START//-/}.repl
[ "${STATUS_ACTION}" != "check" ] && echo -e "${idsCL[LightGreen]}Complete${idsCL[Default]}\n"
touch ${NM_TMPFOLDER}/.replcheck
@@ -833,9 +833,9 @@ REPLCHECK(){
checked=false
until [ "${checked}" == "" ]; do
if [ "${PH_CMD}" == "" ]; then
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl ]] && checked=`ssh -q -o ConnectTimeout=3 -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`
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.${STATUS_START//-/}.repl ]] && checked=`ssh -q -o ConnectTimeout=3 -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 -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl ]] && checked="`${PH_CMD} \"ssh -q -o ConnectTimeout=3 -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\"`"
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.${STATUS_START//-/}.repl ]] && checked="`${PH_CMD} \"ssh -q -o ConnectTimeout=3 -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
@@ -857,9 +857,9 @@ REPLSTART(){
var=${NODETYPE}_REPL_CHECK[@]
if [ ! -z ${!var+x} ]; then
for rcheck in "${!var}"; do
${PH_CMD} rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl
${PH_CMD} rm -f ${NM_FOLDER}/.test.${STATUS_START//-/}.repl
daterun=`date +%Y-%m-%d-%H-%M-%S`
${PH_CMD} "echo -e \"Replcation-Test\n${daterun}\" > ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl" &
${PH_CMD} "echo -e \"Replcation-Test\n${daterun}\" > ${NM_REPL_CHECK_LOC[${rcheck}]}/.test.${STATUS_START//-/}.repl" &
${PH_CMD} 'find ${NM_REPL_CHECK_LOC[${rcheck}]} -iname "*.sync-conflict-*" -exec rm {} \;' &
done
fi