From fdbf2f3eff96ebb8438b81a56c8953663738560e Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 5 Dec 2023 23:11:36 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- inc/services.inc | 4 ---- inc/status.inc | 11 +++-------- inc/status.new.inc | 4 ---- nodemgmt-scripts.sh | 20 -------------------- 5 files changed, 4 insertions(+), 37 deletions(-) diff --git a/defaults.inc b/defaults.inc index eedcf57b..dbe64537 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ #!/usr/bin/env bash -VERS='4.17.101-12052023' +VERS='4.17.102-12052023' 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 ' diff --git a/inc/services.inc b/inc/services.inc index 2211587a..260a3b5c 100755 --- a/inc/services.inc +++ b/inc/services.inc @@ -332,7 +332,6 @@ SERVICE_MGMT(){ var1=${NTYPE}_SERVICES_CHECK[@] # if [[ "${!var1}" = *"${SERVICE['service']}"* ]]; then if [[ " ${!var1} " =~ " ${SERVICE['service']} " ]]; then - nid=1 if [ "${SERVICE['node']}" != "" ]; then var2=(${SERVICE['node']}) sethost=true; @@ -415,7 +414,6 @@ SERVICE_MGMT(){ fi fi # fi - nid=`expr $nid + 1` # if [ "${SERVICE['service']}" = "gitea" ]; then # break # fi @@ -465,7 +463,6 @@ CHECK_DOCKER_SERVICES(){ echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Node Docker Service(s) Status${idsCL[Default]}" DIVIDER; echo -e "${idsST[Reset]}" fi - nid=1 for nip in "${!hosts}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost' @@ -535,7 +532,6 @@ CHECK_DOCKER_SERVICES(){ fi fi if [ "${ST_ACTION}" != "check" ]; then echo; fi - nid=`expr $nid + 1` done fi done diff --git a/inc/status.inc b/inc/status.inc index c441586d..3172528e 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -132,7 +132,6 @@ STATUS(){ ######################## for NTYPE in "${ntypesel[@]}"; do - nid=1 dockers=${NTYPE}_DOCKERS_CHECK[@] hosts=${NTYPE}_HOSTS[@] @@ -451,7 +450,6 @@ STATUS(){ fi [ "${ST_ACTION}" != "check" ] && echo - nid=`expr $nid + 1` done fi #GOFORCHECK @@ -624,7 +622,6 @@ It was down for $(SHOW_TIME ${toterrtime})" echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Node(s) Free Space Scan${idsCL[Default]}" DIVIDER; echo -e "${idsST[Reset]}" fi - nid=1 var=${NTYPE}_HOSTS[@] for nip in "${!var}"; do if [[ $"{RNIP}" == *"${nip}"* ]]; then NCMD=''; LH='- localhost' @@ -721,7 +718,6 @@ It was down for $(SHOW_TIME ${toterrtime})" # fi # done - nid=`expr $nid + 1` echo done done @@ -769,25 +765,24 @@ REPLCHECK(){ } STATUS_SCANTIMES(){ + scandefault=200 while [ $# -gt 0 ]; do case "${1}" in -l|-last) LAST=${2};; -h|-help|--help) echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] scantimes {opt}${idsCL[Default]} {" width=15 - printf "%-${width}s- %s\n" " -l|-last" "(number of last scantimes to average from, defaults to 480)" + printf "%-${width}s- %s\n" " -l|-last" "(number of last scan times to average from, defaults to ${scandefault})" echo -e "}\n" exit 0;; esac shift done - [ "${LAST}" == "" ] && LAST=200 + [ "${LAST}" == "" ] && LAST=${scandefault} echo -en "${idsCL[Yellow]}Pulling data and calculating average scan times for the last '${LAST}' scans ... " - lastscantime=$(tail -n 1 ${NM_LOGFOLDER}/status-check.scantimes) - scantimes=($(tail -n ${LAST} ${NM_LOGFOLDER}/status-check.scantimes)) scantimes_total=0; scansfound=0 for scantime in "${scantimes[@]}"; do diff --git a/inc/status.new.inc b/inc/status.new.inc index 03a69739..991d0f5d 100755 --- a/inc/status.new.inc +++ b/inc/status.new.inc @@ -132,7 +132,6 @@ STATUSNEW(){ ######################## for NTYPE in "${ntypesel[@]}"; do - nid=1 dockers=${NTYPE}_DOCKERS_CHECK[@] hosts=${NTYPE}_HOSTS[@] @@ -451,7 +450,6 @@ STATUSNEW(){ fi [ "${ST_ACTION}" != "check" ] && echo - nid=`expr $nid + 1` done fi #GOFORCHECK @@ -624,7 +622,6 @@ It was down for $(SHOW_TIME ${toterrtime})" echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Node(s) Free Space Scan${idsCL[Default]}" DIVIDER; echo -e "${idsST[Reset]}" fi - nid=1 var=${NTYPE}_HOSTS[@] for nip in "${!var}"; do if [[ $"{RNIP}" == *"${nip}"* ]]; then NCMD=''; LH='- localhost' @@ -721,7 +718,6 @@ It was down for $(SHOW_TIME ${toterrtime})" # fi # done - nid=`expr $nid + 1` echo done done diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 62ba7257..8da22f52 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -56,7 +56,6 @@ BACKUP(){ SET-PERMISSIONS(){ if [ "${1}" = "gitea" ]; then - nid=1 for nip in "${NM_HOSTS['WEB'][@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD='' @@ -78,10 +77,8 @@ SET-PERMISSIONS(){ elif [ "${2}" != "q" ]; then echo -e "${idsCL[Red]}Node is down${idsCL[Default]}" fi - nid=`expr $nid + 1` done elif [ "${1}" = "pdnsadmin" ]; then - nid=1 for nip in "${NM_HOSTS['WEB'][@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD='' @@ -101,7 +98,6 @@ SET-PERMISSIONS(){ elif [ "${2}" != "q" ]; then echo -e "${idsCL[Red]}Node is down${idsCL[Default]}" fi - nid=`expr $nid + 1` done elif [ "${1}" = "nextcloud" ]; then nip=${NC_HOSTS[0]} @@ -131,7 +127,6 @@ SET-PERMISSIONS(){ echo -e "${idsCL[Yellow]}Setting new site folder permissions for (${NM_WWWPATH}/${NEW_SITE})${idsCL[Default]}" fi if [ "${NEW_SITE}" = "xxx" ]; then - nid=1 for nip in "${MYSQL_HOSTS[@]}"; do checkhost=$(CHECK_HOST ${nip}) if [ "${checkhost}" != "false" ]; then @@ -148,10 +143,8 @@ SET-PERMISSIONS(){ echo -e "${idsCL[Green]}Complete${idsCL[Default]}" echo fi - nid=`expr $nid + 1` done fi - nid=1 [ "${NM_WWWPATHS['WEB']}" != "" ] && WWWPATH=${NM_WWWPATHS['WEB']} || WWWPATH=/var/www for nip in "${NM_HOSTS['WEB'][@]}"; do checkhost=$(CHECK_HOST ${nip}) @@ -186,7 +179,6 @@ SET-PERMISSIONS(){ echo fi fi - nid=`expr $nid + 1` done if [ "${NEW_SITE}" != "" ]; then echo ; fi if [ -z ${ACTION} ] || [ "${ACTION}" = "gui" ]; then @@ -200,7 +192,6 @@ HAPROXY-CONFIG() { DIVIDER false yellow # if [[ "${MYSQLSERVICES_CHECK}" = *"haproxy"* ]]; then if [[ " ${MYSQL_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then - nid=1 for nip in "${MYSQL_HOSTS[@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then nip='localhost ' @@ -215,13 +206,11 @@ HAPROXY-CONFIG() { ${NCMD} "sed -e 's;%NIP%;${nip};g' ${NM_FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg" echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" - nid=`expr $nid + 1` done echo fi # if [[ "${WEBSERVICES_CHECK}" = *"haproxy"* ]]; then if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then - nid=1 for nip in "${NM_HOSTS['WEB'][@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then nip='localhost ' @@ -236,12 +225,10 @@ HAPROXY-CONFIG() { ${NCMD} "sed -e 's;%NIP%;${nip};g' ${NM_FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg" echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" - nid=`expr $nid + 1` done fi # if [[ "${LBSERVICES_CHECK}" = *"haproxy"* ]]; then if [[ " ${LB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then - nid=1 for nip in "${LB_HOSTS[@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then nip='localhost ' @@ -256,7 +243,6 @@ HAPROXY-CONFIG() { ${NCMD} "sed -e 's;%NIP%;${nip};g' ${NM_FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg" echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" - nid=`expr $nid + 1` done fi SERVICE_MGMT haproxy reload @@ -271,7 +257,6 @@ KEEPALIVE-CONFIG() { DIVIDER false yellow # if [[ "${MYSQLSERVICES_CHECK}" = *"keepalive"* ]]; then if [[ " ${MYSQL_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then - nid=1 for nip in "${MYSQL_HOSTS[@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then nip='localhost ' @@ -286,13 +271,11 @@ KEEPALIVE-CONFIG() { ${NCMD} "sed -e 's;%NIP%;${nip};g' ${NM_FOLDER}/templates/keepalived.config > /etc/keepalived/keepalived.conf" echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" - nid=`expr $nid + 1` done echo fi # if [[ "${WEBSERVICES_CHECK}" = *"keepalive"* ]]; then if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then - nid=1 for nip in "${NM_HOSTS['WEB'][@]}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then nip='localhost ' @@ -307,7 +290,6 @@ KEEPALIVE-CONFIG() { ${NCMD} "sed -e 's;%NIP%;${nip};g' ${NM_FOLDER}/templates/keepalived.config > /etc/keepalived/keepalived.conf" echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}" - nid=`expr $nid + 1` done fi SERVICE_MGMT keepalived reload @@ -589,7 +571,6 @@ RUN_COMMAND(){ echo -e "${idsST[Bold]}"; DIVIDER echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14}\` }${idsCL[Default]}" DIVIDER; echo -e "${idsST[Reset]}" - nid=1 var=${NTYPE}_HOSTS[@] for nip in "${!var}"; do @@ -602,7 +583,6 @@ RUN_COMMAND(){ ${NCMD} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} DIVIDER false green echo - nid=`expr $nid + 1` done echo done