This commit is contained in:
2023-12-12 13:58:18 -06:00
parent c40aad23df
commit de9d727f48
3 changed files with 59 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERS='5.1.13-12122023' VERS='5.1.19-12122023'
NM_BETA=false 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 ' 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 '

View File

@@ -3,7 +3,6 @@ STATUS(){
start=$(date +%s) start=$(date +%s)
log_start=$(date "+%Y-%m-%d %H:%M:%S") log_start=$(date "+%Y-%m-%d %H:%M:%S")
if [ "${1}" != "-h" ]; then
if [ "${1}" != "" ] && [ "${NM_NODETYPES[${1^^}]}" != "" ]; then if [ "${1}" != "" ] && [ "${NM_NODETYPES[${1^^}]}" != "" ]; then
ntss=${1^^} ntss=${1^^}
ntypesel=(${ntss}) ntypesel=(${ntss})
@@ -13,27 +12,14 @@ STATUS(){
ntypesel=(${NM_NODE_TYPES[@]}) ntypesel=(${NM_NODE_TYPES[@]})
[ "${1}" == "sync" ] && STATUS_ACTION=repl || STATUS_ACTION=${1} [ "${1}" == "sync" ] && STATUS_ACTION=repl || STATUS_ACTION=${1}
fi fi
fi # while [ $# -gt 0 ]; do
while [ $# -gt 0 ]; do # case "$1" in
case "$1" in # -site) DEL_SITE=${2};;
-site) DEL_SITE=${2};; # -ssl) DEL_SSL=${2};;
-ssl) DEL_SSL=${2};; #
-h) # esac
echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] status {status-check}${idsCL[Default]} {" # shift
width=25 # done
printf "%-${width}s- %s\n" " {status-check}" "By default will check everything, otherwise specifically specify item to check:"
printf "%-${width}s- %s\n" " services" "Will verify status of all node services"
printf "%-${width}s- %s\n" " dockers" "Will verify status of all node dockers"
printf "%-${width}s- %s\n" " repl" "Will verify status of all node replications"
echo -e "}\n"
rm -Rf ${STATUSRUN_TMPFOLDER}
exit 0
;;
esac
shift
done
PRI_CW=40 PRI_CW=40
declare -i cw; declare -i spc1; declare -i c declare -i cw; declare -i spc1; declare -i c

View File

@@ -1023,7 +1023,24 @@ GUI(){
if [ "${2}" == "freespace" ]; then if [ "${2}" == "freespace" ]; then
STATUS freespace ${3} STATUS freespace ${3}
else else
if [ ! -f ${NM_TMPFOLDER}/.statusclean ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.statusclean)) -ge 3600 ]; then
for oldstatus_check in ${NM_TMPFOLDER}/status-*; do
[ -d "${oldstatus_check}" ] && [ $(expr $(date +%s) - $(stat -c %Y ${oldstatus_check})) -ge 1200 ] && rm -Rf ${oldstatus_check}
done
touch ${NM_TMPFOLDER}/.statusclean
fi
STATUSRUNS=($(find ${NM_TMPFOLDER}/* -maxdepth 1 -type d -iname "status-*" 2>/dev/null)) STATUSRUNS=($(find ${NM_TMPFOLDER}/* -maxdepth 1 -type d -iname "status-*" 2>/dev/null))
if [ "${2}" == "-h" ] || [ "${2}" == "-help" ]; then
echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] status {status-check}${idsCL[Default]} {"
width=25
printf "%-${width}s- %s\n" " {status-check}" "By default will check everything, otherwise specifically specify item to check:"
printf "%-${width}s- %s\n" " services" "Will verify status of all node services"
printf "%-${width}s- %s\n" " dockers" "Will verify status of all node dockers"
printf "%-${width}s- %s\n" " repl" "Will verify status of all node replications"
echo -e "}\n"
rm -Rf ${STATUSRUN_TMPFOLDER}
exit 0
else
if [ ${#STATUSRUNS[@]} -lt 3 ]; then if [ ${#STATUSRUNS[@]} -lt 3 ]; then
STATUS_START=$(date +%Y-%m-%d-%H-%M-%S) STATUS_START=$(date +%Y-%m-%d-%H-%M-%S)
STATUSRUN_TMPFOLDER="${NM_TMPFOLDER}/status-${STATUS_START}" STATUSRUN_TMPFOLDER="${NM_TMPFOLDER}/status-${STATUS_START}"
@@ -1042,13 +1059,6 @@ GUI(){
mv ${STATUSRUN_TMPFOLDER}/status-check.running ${NM_LOGFOLDER}/status-check.lastrun mv ${STATUSRUN_TMPFOLDER}/status-check.running ${NM_LOGFOLDER}/status-check.lastrun
rm -Rf ${STATUSRUN_TMPFOLDER} rm -Rf ${STATUSRUN_TMPFOLDER}
if [ ! -f ${NM_TMPFOLDER}/.statusclean ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.statusclean)) -ge 3600 ]; then
for oldstatus_check in ${NM_TMPFOLDER}/status-*; do
[ -d "${oldstatus_check}" ] && [ $(expr $(date +%s) - $(stat -c %Y ${oldstatus_check})) -ge 1200 ] && rm -Rf ${oldstatus_check}
done
touch ${NM_TMPFOLDER}/.statusclean
fi
if [ "${3}" == "email" ]; then if [ "${3}" == "email" ]; then
echo -e "\n\n" >> ${NM_LOGFOLDER}/status-check.lastrun echo -e "\n\n" >> ${NM_LOGFOLDER}/status-check.lastrun
DOWNLIST report >> ${NM_LOGFOLDER}/status-check.lastrun DOWNLIST report >> ${NM_LOGFOLDER}/status-check.lastrun
@@ -1060,15 +1070,6 @@ GUI(){
rm -Rf ${STATUSRUN_TMPFOLDER} rm -Rf ${STATUSRUN_TMPFOLDER}
fi fi
else
for oldstatus_check in ${NM_TMPFOLDER}/status-*; do
[ -d "${oldstatus_check}" ] && [ $(expr $(date +%s) - $(stat -c %Y ${oldstatus_check})) -ge 1200 ] && rm -Rf ${oldstatus_check}
done
touch ${NM_TMPFOLDER}/.statusclean
STATUSRUNS=($(find ${NM_TMPFOLDER}/* -maxdepth 1 -type d -iname "status-*" 2>/dev/null))
if [ ${#STATUSRUNS[@]} -lt 3 ]; then
${NM_SCRIPT} status ${2} ${3} ${4}
exit 0
else else
[ "${MM_ACTION}" != "report" ] && echo -e "${idsCL[LightRed]}Whooooaaaaa there cowboy, we got 3 threads running already.... easy killer!${idsCL[Default]}\n" [ "${MM_ACTION}" != "report" ] && echo -e "${idsCL[LightRed]}Whooooaaaaa there cowboy, we got 3 threads running already.... easy killer!${idsCL[Default]}\n"
if [ ! -f ${NM_TMPFOLDER}/.overload ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.overload)) -ge 600 ]; then if [ ! -f ${NM_TMPFOLDER}/.overload ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.overload)) -ge 600 ]; then