This commit is contained in:
2023-07-16 22:32:02 -05:00
parent c35401f557
commit 07a8f8ce51
6 changed files with 17 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
VERS='4.10.5-07162023'
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns '
@@ -18,7 +18,7 @@ declare -i errtime
NM_SRVCOPT=(start stop restart reload enable disable)
if [ -f ${NM_FOLDER}/defaults.local.inc ]; then
if [ -f ${NM_FOLDER}/conf/defaults.local.inc ]; then
declare -A NM_HOSTS
declare -A NM_SERVICES_CHECK
declare -A NM_DOCKERS_CHECK
@@ -37,7 +37,7 @@ if [ -f ${NM_FOLDER}/defaults.local.inc ]; then
declare -A NM_CERTPATHS
declare -A NM_WWWPATHS
source ${NM_FOLDER}/defaults.local.inc
source ${NM_FOLDER}/conf/defaults.local.inc
IFS=,
LOCAL_SERVICES=(${LOCAL_SERVICES})

View File

@@ -19,9 +19,6 @@ if [ ! -d "/opt/idssys/defaults" ]; then
git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
fi
if [ ! -d "/opt/idssys/settings" ]; then
mkdir /opt/idssys/settings
fi
echo -e "NODE_HOSTNAME=\"$(hostname)\"
#LOCAL_SERVICES=mysql,nginx,gitea,haproxy,keepalived,maxscale
@@ -30,7 +27,7 @@ echo -e "NODE_HOSTNAME=\"$(hostname)\"
# PUSHOVER_APP_TOKEN=""
# PUSHOVER_USER_TOKEN=""
" > /opt/idssys/nodemgmt/settings.conf
" > /opt/idssys/nodemgmt/conf/settings.conf
echo

View File

@@ -5,7 +5,8 @@ action="$1"
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
source /opt/idssys/nodemgmt/settings.conf
source /opt/idssys/nodemgmt/conf/settings.conf
source /opt/idssys/nodemgmt/defaults.inc
source /opt/idssys/nodemgmt/inc/status.inc
@@ -339,7 +340,7 @@ NODEUPDATE() {
echo
nmdiv=$(ssh -tq root@${nmip} ls -l --time-style=+%s ${NM_FOLDER}/defaults.local.inc | cut -d ' ' -f 6)
nmdiv=$(ssh -tq root@${nmip} ls -l --time-style=+%s ${NM_FOLDER}/conf/defaults.local.inc | cut -d ' ' -f 6)
for NTYPE in "${NM_NODE_TYPES[@]}"; do
nid=1
@@ -357,7 +358,7 @@ NODEUPDATE() {
echo -en " ~ ${idsCL[LightCyan]}NodeMGMT${idsCL[Default]} : "
if ! ${NCMD} command -v nodemgmt > /dev/null; then
${NCMD} "bash <(curl -sL https://go.scity.us/install-nodemgmt)" >/dev/null 2>&1
ssh -tq root@${nmip} rsync -az ${NM_FOLDER}/defaults.local.inc root@${nip}:${NM_FOLDER}/ >/dev/null 2>&1
ssh -tq root@${nmip} rsync -az ${NM_FOLDER}/conf/defaults.local.inc root@${nip}:${NM_FOLDER}/ >/dev/null 2>&1
echo -e "${idsCL[Green]}Installed & Synced${idsCL[Default]}"
else
${NCMD} "nodemgmt update q"
@@ -373,8 +374,8 @@ NODEUPDATE() {
else
echo -en " ~ ${idsCL[LightCyan]}Sync Defaults${idsCL[Default]} : "
if ssh -tq root@${nip} [[ ! -f ${NM_FOLDER}/defaults.local.inc ]] || [ ${nmdiv} -ne $(ssh -tq root@${nip} ls -l --time-style=+%s ${NM_FOLDER}/defaults.local.inc | cut -d ' ' -f 6) ]; then
ssh -tq root@${nmip} rsync -az ${NM_FOLDER}/defaults.local.inc ${NM_FOLDER}/ssl-domain-checks.conf root@${nip}:${NM_FOLDER}/ >/dev/null 2>&1
if ssh -tq root@${nip} [[ ! -f ${NM_FOLDER}/conf/defaults.local.inc ]] || [ ${nmdiv} -ne $(ssh -tq root@${nip} ls -l --time-style=+%s ${NM_FOLDER}/conf/defaults.local.inc | cut -d ' ' -f 6) ]; then
ssh -tq root@${nmip} rsync -az ${NM_FOLDER}/conf/defaults.local.inc ${NM_FOLDER}/ssl-domain-checks.conf root@${nip}:${NM_FOLDER}/ >/dev/null 2>&1
echo -e "${idsCL[Green]}NodeMgmt Defaults File Synced${idsCL[Default]}"
else
echo -e "${idsCL[Green]}NodeMgmt Defaults File Already Synced${idsCL[Default]}"
@@ -674,18 +675,18 @@ UPDATEPUSHOVERINFO(){
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
if [ "${checkhost}" != "false" ]; then
echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Running commands${idsCL[Default]}${idsST[Reset]}"
ssh root@${host_ip[$hostid]} "/bin/sed -i '/PUSHOVER_/d' /opt/idssys/nodemgmt/settings.conf"
ssh root@${host_ip[$hostid]} "/bin/sed -i '/PUSHOVER_/d' /opt/idssys/nodemgmt/conf/settings.conf"
if [ "${PUSHOVER_APP_TOKEN}" != "" ]; then
echo "putting in info 'root@${host_ip[$hostid]}'"
ssh root@${host_ip[$hostid]} "echo PUSHOVER_APP_TOKEN=\\\"${PUSHOVER_APP_TOKEN}\\\" >> ${MMFOLDER}/settings.conf; echo 'yes1'"
ssh root@${host_ip[$hostid]} "echo PUSHOVER_APP_TOKEN=\\\"${PUSHOVER_APP_TOKEN}\\\" >> ${MMFOLDER}/conf/settings.conf;"
else
echo "taking out info"
ssh root@${host_ip[$hostid]} "echo \# PUSHOVER_APP_TOKEN=\\\"\\\" >> ${MMFOLDER}/settings.conf"
ssh root@${host_ip[$hostid]} "echo \# PUSHOVER_APP_TOKEN=\\\"\\\" >> ${MMFOLDER}/conf/settings.conf"
fi
if [ "${PUSHOVER_USER_TOKEN}" != "" ]; then
ssh root@${host_ip[$hostid]} "echo PUSHOVER_USER_TOKEN=\\\"${PUSHOVER_USER_TOKEN}\\\" >> ${MMFOLDER}/settings.conf; echo 'yes2'"
ssh root@${host_ip[$hostid]} "echo PUSHOVER_USER_TOKEN=\\\"${PUSHOVER_USER_TOKEN}\\\" >> ${MMFOLDER}/conf/settings.conf;"
else
ssh root@${host_ip[$hostid]} "echo \# PUSHOVER_USER_TOKEN=\\\"\\\" >> ${MMFOLDER}/settings.conf"
ssh root@${host_ip[$hostid]} "echo \# PUSHOVER_USER_TOKEN=\\\"\\\" >> ${MMFOLDER}/conf/settings.conf"
fi
else

4
run.sh
View File

@@ -2,12 +2,12 @@
# NodeMgmt Loader
if [ -f /opt/idssys/settings/nodemgmt.conf ]; then
mv /opt/idssys/settings/nodemgmt.conf /opt/idssys/nodemgmt/settings.conf
mv /opt/idssys/settings/nodemgmt.conf /opt/idssys/nodemgmt/conf/settings.conf
fi
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
source /opt/idssys/nodemgmt/settings.conf
source /opt/idssys/nodemgmt/conf/settings.conf
source /opt/idssys/nodemgmt/defaults.inc
# if [[ "${noheader}" != *" ${1} "* ]] && [[ "${noheader}" != *" ${2} "* ]] && [ "${1}" != "status" ]; then