From 4af22bcffb96ac19fa6081d987f96495ff7e444b Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 25 Nov 2023 22:03:28 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- inc/services.inc | 8 ++++---- inc/status.inc | 10 +++++----- nodemgmt-scripts.sh | 22 +++++++++++----------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/defaults.inc b/defaults.inc index 0eb0c1df..e8ab1dee 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ #!/usr/bin/env bash -VERS='4.16.1-11252023' +VERS='4.16.5-11252023' 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 ' CERT_DAEMON='/snap/bin/certbot' diff --git a/inc/services.inc b/inc/services.inc index e6868071..c0657b9c 100755 --- a/inc/services.inc +++ b/inc/services.inc @@ -167,7 +167,7 @@ SERVICE_MGMT(){ nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi [ ${QUIET} -eq 0 ] && echo -en "${NM_SRVCOPTS[${SERVICE['action']}]}ing on '$nip'... ${idsCL[Default]}" @@ -201,7 +201,7 @@ SERVICE_MGMT(){ nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi if [ ${QUIET} -eq 0 ]; then @@ -359,7 +359,7 @@ SERVICE_MGMT(){ nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi NOGOCHK=true; @@ -469,7 +469,7 @@ CHECK_DOCKER_SERVICES(){ for nip in "${!hosts}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost' - else NCMD="ssh root@${nip}"; LH='' + else NCMD="ssh -o ConnectTimeout=3 root@${nip}"; LH='' fi if [ "${NCMD}" != "" ]; then checkhost=$(CHECK_HOST ${nip}) diff --git a/inc/status.inc b/inc/status.inc index 9dfd9d59..93c81ddf 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -235,7 +235,7 @@ STATUS(){ mysqlgo=true fi else - if [ "$(ssh root@${nip} ps -U root | grep "offsite-power-check.sh start" | grep -v "grep" | awk '{print $1}')" != "" ]; then + if [ "$(ssh -o ConnectTimeout=3 root@${nip} ps -U root | grep "offsite-power-check.sh start" | grep -v "grep" | awk '{print $1}')" != "" ]; then srvctest=active else srvctest=notactive @@ -661,7 +661,7 @@ It was down for $(SHOW_TIME ${toterrtime})" var=${NTYPE}_HOSTS[@] for nip in "${!var}"; do if [[ $"{RNIP}" == *"${nip}"* ]]; then NCMD=''; LH='- localhost' - else NCMD="ssh root@${nip}"; LH='' + else NCMD="ssh -o ConnectTimeout=3 root@${nip}"; LH='' fi if [ "${ST_ACTION}" != "check" ]; then echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]} [${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYellow]}${LH}${idsCL[Default]}" @@ -670,7 +670,7 @@ It was down for $(SHOW_TIME ${toterrtime})" [ "${ST_ACTION}" != "check" ] && [ "${2}" != "report" ] && echo -en " ${idsCL[LightCyan]}Getting drives from server ... ${idsCL[Default]}" declare -A partitions - DRIVEINFO=$(ssh 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 -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=(${DRIVEINFO}) if [ "${2}" != "report" ]; then echo -en "\e[1A" @@ -792,9 +792,9 @@ REPLCHECK(){ checked=false until [ "${checked}" == "" ]; do if [ "${PH_CMD}" == "" ]; then - ssh -q root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl ]] && checked=`ssh root@${nip} "cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl` + ssh -q root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl ]] && checked=`ssh -o ConnectTimeout=3 root@${nip} "cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl` else - ssh -q root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl ]] && checked="`${PH_CMD} \"ssh root@${nip} \"cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl\" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl\"`" + ssh -q root@${nip} [[ -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl ]] && checked="`${PH_CMD} \"ssh -o ConnectTimeout=3 root@${nip} \"cat ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl\" | diff - ${NM_REPL_CHECK_LOC[${rcheck}]}/test.repl\"`" fi [ "`date +%s`" -gt "${timeout}" ] && timeout=true && break done diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index be680d8f..62b17763 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -60,7 +60,7 @@ SET-PERMISSIONS(){ if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi if [ "${2}" != "q" ]; then echo -en "${idsCL[Yellow]}Resetting folder permissions for Gitea on ${NM_HOSTNAMES[${nip}]} (${nip})... ${idsCL[Default]}" @@ -85,7 +85,7 @@ SET-PERMISSIONS(){ if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi if [ "${2}" != "q" ]; then echo -en "${idsCL[Yellow]}Resetting folder permissions for PowerDNS-Admin on ${NM_HOSTNAMES[${nip}]} (${nip})... ${idsCL[Default]}" @@ -107,7 +107,7 @@ SET-PERMISSIONS(){ if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi if [ "${2}" != "q" ]; then echo -en "${idsCL[Yellow]}Resetting folder permissions for Nextcloud on ${NM_HOSTNAMES[${nip}]} (${nip})... ${idsCL[Default]}" @@ -138,7 +138,7 @@ SET-PERMISSIONS(){ nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi echo -e "${idsCL[Yellow]}Setting folder permissions for ${NM_HOSTNAMES[${nip}]} (${nip})${idsCL[Default]}" echo -en "${idsCL[Cyan]}LetsEncrypt Certs ${idsCL[Default]}" @@ -159,7 +159,7 @@ SET-PERMISSIONS(){ nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi if [ "${NEW_SITE}" != "" ]; then echo -en "${idsCL[Cyan]}${NM_HOSTNAMES[${nip}]} (${nip}) ${idsCL[Default]}" @@ -205,7 +205,7 @@ HAPROXY-CONFIG() { nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi echo -en "Creating File on ${NM_HOSTNAMES[${nip}]} ($nip)... ${idsCL[Default]}" @@ -226,7 +226,7 @@ HAPROXY-CONFIG() { nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi echo -en "Creating File on ${NM_HOSTNAMES[${nip}]} ($nip)... ${idsCL[Default]}" @@ -246,7 +246,7 @@ HAPROXY-CONFIG() { nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi echo -en "Creating File on ${NM_HOSTNAMES[${nip}]} ($nip)... ${idsCL[Default]}" @@ -276,7 +276,7 @@ KEEPALIVE-CONFIG() { nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi echo -en "Creating File on ${NM_HOSTNAMES[${nip}]} ($nip)... ${idsCL[Default]}" @@ -297,7 +297,7 @@ KEEPALIVE-CONFIG() { nip='localhost ' NCMD='' else - NCMD="ssh root@${nip}" + NCMD="ssh -o ConnectTimeout=3 root@${nip}" fi echo -en "Creating File on ${NM_HOSTNAMES[${nip}]} ($nip)... ${idsCL[Default]}" @@ -589,7 +589,7 @@ RUN_COMMAND(){ var=${NTYPE}_HOSTS[@] for nip in "${!var}"; do if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost' - else NCMD="ssh root@${nip}"; LH='' + else NCMD="ssh -o ConnectTimeout=3 root@${nip}"; LH='' fi echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]}[${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYellow]}${LH}${idsCL[Default]}" DIVIDER false green