update
This commit is contained in:
24
defaults.inc
24
defaults.inc
@@ -1,18 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
VERS='4.13.36-11142023'
|
||||
VERS='4.14.4-11142023'
|
||||
|
||||
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update '
|
||||
CERT_DAEMON='/snap/bin/certbot'
|
||||
NM_FOLDER=/opt/idssys/nodemgmt
|
||||
NM_SCRIPT=${NM_FOLDER}/nodemgmt-scripts.sh
|
||||
NM_TMPFOLDER=${NM_FOLDER}/.tmp
|
||||
NM_LOGFOLDER=${NM_FOLDER}/logs
|
||||
NM_LOGFILE=${NM_LOGFOLDER}/logfile
|
||||
|
||||
RENOTIFY_TIMEOUT=3600
|
||||
|
||||
[ ! -d ${NM_TMPFOLDER} ] && mkdir ${NM_TMPFOLDER}
|
||||
[ ! -d ${NM_LOGFOLDER} ] && mkdir ${NM_LOGFOLDER}
|
||||
|
||||
declare -i errtime
|
||||
|
||||
@@ -39,6 +29,18 @@ 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
|
||||
|
||||
@@ -80,7 +80,7 @@ STATUS(){
|
||||
echo "$(date) - LOCAL - ${NODE_HOSTNAME} - ${NM_SERVICE_DESC[${srvc}]} is down" >> ${NM_LOGFILE}
|
||||
else
|
||||
errtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${NODE_HOSTNAME}~${srvc}.down)
|
||||
if [ $errtime -gt ${RENOTIFY_TIMEOUT} ]; then
|
||||
if [ $errtime -gt ${NM_RENOTIFY_TIMEOUT} ]; then
|
||||
if [ ! -f ${NM_TMPFOLDER}/${NODE_HOSTNAME}~${srvc}.errtime ]; then
|
||||
mv ${NM_TMPFOLDER}/${NODE_HOSTNAME}~${srvc}.down ${NM_TMPFOLDER}/${NODE_HOSTNAME}~${srvc}.errtime
|
||||
fi
|
||||
@@ -226,7 +226,7 @@ STATUS(){
|
||||
|
||||
elif [ ! -f ${NM_TMPFOLDER}/${nip}~${srvc}.disable ]; then
|
||||
errtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${nip}~${srvc}.down)
|
||||
if [ $errtime -gt ${RENOTIFY_TIMEOUT} ]; then
|
||||
if [ $errtime -gt ${NM_RENOTIFY_TIMEOUT} ]; then
|
||||
[ ! -f ${NM_TMPFOLDER}/${nip}~${srvc}.errtime ] && mv ${NM_TMPFOLDER}/${nip}~${srvc}.down ${NM_TMPFOLDER}/${nip}~${srvc}.errtime
|
||||
toterrtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${nip}~${srvc}.errtime)
|
||||
touch ${NM_TMPFOLDER}/${nip}~${srvc}.down
|
||||
@@ -299,7 +299,7 @@ STATUS(){
|
||||
#
|
||||
# else
|
||||
# errtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${nip}~${srvc}.down)
|
||||
# if [ $errtime -gt ${RENOTIFY_TIMEOUT} ]; then
|
||||
# if [ $errtime -gt ${NM_RENOTIFY_TIMEOUT} ]; then
|
||||
# if [ ! -f ${NM_TMPFOLDER}/${nip}~${srvc}.errtime ]; then
|
||||
# mv ${NM_TMPFOLDER}/${nip}~${srvc}.down ${NM_TMPFOLDER}/${nip}~${srvc}.errtime
|
||||
# fi
|
||||
@@ -395,7 +395,7 @@ STATUS(){
|
||||
echo "$(date) - ${nip} - ${NM_HOSTNAMES[${nip}]}[${nip}] - ${NM_DOCKER_DESC[${docker}]} (docker) is down, could not fix" >> ${NM_LOGFILE}
|
||||
else
|
||||
errtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${nip}~${docker}.down)
|
||||
if [ $errtime -gt ${RENOTIFY_TIMEOUT} ]; then
|
||||
if [ $errtime -gt ${NM_RENOTIFY_TIMEOUT} ]; then
|
||||
if [ ! -f ${NM_TMPFOLDER}/${nip}~${docker}.errtime ]; then
|
||||
mv ${NM_TMPFOLDER}/${nip}~${docker}.down ${NM_TMPFOLDER}/${nip}~${docker}.errtime
|
||||
fi
|
||||
@@ -438,13 +438,13 @@ STATUS(){
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -e "${idsCL[Red]} - Node has been down for $(SHOW_TIME ${toterrtime}) ${idsCL[LightYello]}${LH}${idsCL[Default]}"
|
||||
fi
|
||||
if [ $errtime -gt ${RENOTIFY_TIMEOUT} ]; then
|
||||
if [ $errtime -gt ${NM_RENOTIFY_TIMEOUT} ]; then
|
||||
SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] has been down for $(SHOW_TIME ${toterrtime})" 1
|
||||
elif [ $errtime -gt 60 ] && [ $errtime -lt 180 ] && [ ! -f ${NM_TMPFOLDER}/${nip}.errtime ]; then
|
||||
SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}]" "${NM_HOSTNAMES[${nip}]}[${nip}] is down" 1
|
||||
fi
|
||||
touch ${NM_TMPFOLDER}/${nip}.down
|
||||
# if [ $errtime -gt ${RENOTIFY_TIMEOUT} ] && [ "${EMAIL_NOTICE}" != "" ]; then
|
||||
# if [ $errtime -gt ${NM_RENOTIFY_TIMEOUT} ] && [ "${EMAIL_NOTICE}" != "" ]; then
|
||||
# echo "${NM_HOSTNAMES[${nip}]}[${nip}] has been down for $(SHOW_TIME ${toterrtime})" | mail -s "${NM_HOSTNAMES[${nip}]}[${nip}]" ${EMAIL_NOTICE}
|
||||
# fi
|
||||
fi
|
||||
@@ -536,7 +536,7 @@ STATUS(){
|
||||
else
|
||||
snderrtime=`expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}~${rcheck}.repl.down)`
|
||||
# echo "HERE: $snderrtime"
|
||||
if [ ${snderrtime} -gt ${RENOTIFY_TIMEOUT} ]; then
|
||||
if [ ${snderrtime} -gt ${NM_RENOTIFY_TIMEOUT} ]; then
|
||||
toterrtime=`expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}~${rcheck}.repl.errtime)`
|
||||
SENDNOTICE "Repl-Timeout-'${NM_HOSTNAMES[${nip}]}[${nip}]'" "${NM_REPL_DESC[${rcheck}]} (${NM_REPL_CHECK_LOC[${rcheck}]})
|
||||
It has been down for $(SHOW_TIME ${toterrtime})" 1
|
||||
|
||||
@@ -23,13 +23,13 @@ fi
|
||||
|
||||
|
||||
BACKUP(){
|
||||
BACKUP_FOLDER=/opt/idssys/backups/node-backup/$(date +%m-%d-%y)/$(date +%H-%M-%S)
|
||||
backupfolder=/opt/idssys/backups/node-backup/$(date +%m-%d-%y)/$(date +%H-%M-%S)
|
||||
#BACKUP_FOLDER=/opt/idssys/backups/node-backups/${NODE_HOSTNAME} #/`date +%Y-%m-%d`
|
||||
#BACKUP_TIMEFOLDER=${BACKUP_DAYFOLDER}/`date +%H-%M`
|
||||
# if [ "${action}" != "backup" ]; then
|
||||
echo -e "${idsCL[Green]}Backing up Node Settings and Files...${idsCL[Default]}"
|
||||
DIVIDER true
|
||||
# fi
|
||||
echo
|
||||
echo -e "${idsCL[Yellow]}Backup Path: ${idsCL[Yellow]}${BACKUP_FOLDER}${idsCL[Default]}\n\n"
|
||||
echo -e "${idsCL[Green]}Backing up Node Settings and Files...${idsCL[Default]}"
|
||||
DIVIDER true
|
||||
[ ! -d ${BACKUP_FOLDER} ] && mkdir -p ${BACKUP_FOLDER}
|
||||
for item in "${!NM_BACKUP_ITEMS[@]}"; do
|
||||
c=0; spc=''; spc1=`expr 20 - ${#item}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||
@@ -44,7 +44,7 @@ BACKUP(){
|
||||
touch ${NM_LOGFOLDER}/backup.lastrun
|
||||
echo
|
||||
DIVIDER true
|
||||
echo -e "${idsCL[Green]}Backups were successfully created in: ${idsCL[Yellow]}${BACKUP_FOLDER}${idsCL[Default]}"
|
||||
echo -e "${idsCL[Green]}Backups were successfully created in: ${idsCL[Yellow]}${BACKUP_FOLDER}${idsCL[Default]}\n\n"
|
||||
if [ -z $action ] || [ "${action}" = "gui" ]; then
|
||||
ENTER2CONTINUE
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user