From 317a3ced4e2559d1076ca2ab9ff89c4d5d97492b Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 14 Nov 2023 14:48:48 -0600 Subject: [PATCH] Update defaults.inc --- defaults.inc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/defaults.inc b/defaults.inc index 36ef9dbb..e714e687 100755 --- a/defaults.inc +++ b/defaults.inc @@ -5,7 +5,7 @@ noheader=' service status-check nightlyrephp7.3-fpm,new backup report check chec CERT_DAEMON='/snap/bin/certbot' declare -i errtime - +[ "${NM_FOLDER}" == "" ] && NM_FOLDER=/opt/idssys/nodemgmt NM_SRVCOPT=(start stop restart reload enable disable) if [ -f ${NM_FOLDER}/conf/defaults.local.inc ]; then @@ -29,18 +29,6 @@ if [ -f ${NM_FOLDER}/conf/defaults.local.inc ]; then source ${NM_FOLDER}/conf/defaults.local.inc - [ "${NM_FOLDER}" == "" ] && NM_FOLDER=/opt/idssys/nodemgmt - [ "${NM_BACKUP_FOLDER}" == "" ] && NM_BACKUP_FOLDER=/opt/idssys/backups/node-backup - NM_SCRIPT=${NM_FOLDER}/nodemgmt-scripts.sh - NM_TMPFOLDER=${NM_FOLDER}/.tmp - [ "${NM_LOGFOLDER}" == "" ] && NM_LOGFOLDER=${NM_FOLDER}/logs - NM_LOGFILE=${NM_LOGFOLDER}/logfile - - [ ! -d ${NM_TMPFOLDER} ] && mkdir ${NM_TMPFOLDER} - [ ! -d ${NM_LOGFOLDER} ] && mkdir ${NM_LOGFOLDER} - - [ "${NM_RENOTIFY_TIMEOUT}" == "" ] && NM_RENOTIFY_TIMEOUT=3600 - IFS=, LOCAL_SERVICES=(${LOCAL_SERVICES}) unset IFS @@ -110,6 +98,19 @@ if [ -f ${NM_FOLDER}/conf/defaults.local.inc ]; then fi +[ "${NM_FOLDER}" == "" ] && NM_FOLDER=/opt/idssys/nodemgmt +[ "${NM_BACKUP_FOLDER}" == "" ] && NM_BACKUP_FOLDER=/opt/idssys/backups/node-backup +NM_SCRIPT=${NM_FOLDER}/nodemgmt-scripts.sh +NM_TMPFOLDER=${NM_FOLDER}/.tmp +[ "${NM_LOGFOLDER}" == "" ] && NM_LOGFOLDER=${NM_FOLDER}/logs +NM_LOGFILE=${NM_LOGFOLDER}/logfile + +[ ! -d ${NM_TMPFOLDER} ] && mkdir ${NM_TMPFOLDER} +[ ! -d ${NM_LOGFOLDER} ] && mkdir ${NM_LOGFOLDER} + +[ "${NM_RENOTIFY_TIMEOUT}" == "" ] && NM_RENOTIFY_TIMEOUT=3600 + + TSI=$(/sbin/ip link | grep tailscale0) && [ ${#TSI} != 0 ] && RUN_NODE_TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) || RUN_NODE_TSIP= [ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && RNIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) || RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)