Update nodemgmt-scripts.sh

This commit is contained in:
2023-11-08 22:25:54 -06:00
parent 6b3c4f19e2
commit 3bd004c2ec

View File

@@ -679,7 +679,10 @@ DOWNLIST(){
fi
declare -i cw; declare -i spc1; declare -i c
DOWN_LIST=`find ${NM_FOLDER} -name "*.down"`
IFS=$'\n'
read -rd '' -a DOWNLIST <<<"${DOWN_LIST}"
unset IFS
if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true
fi
@@ -724,16 +727,11 @@ DOWNLIST(){
until [ "${choice^^}" = "D" ]; do
cw=50; cw2=65; is=1;
for downitem in ${DOWN_LIST}; do
for downitem in ${DOWNLIST[@]}; do
ditem=${downitem##*/}
ditem=${ditem//.down}
host=${ditem%%~*}
item=${ditem#*~}
if [ "${1}" == "ignore" ]; then
[ ${is} -lt 10 ] && ignsel=" ${is}) " || ignsel="${is}) "
else
ignsel=""
fi
if [[ $ditem == *"~"* ]] && [ "${NM_SERVICE_DESC[${item}]}" != "" ]; then
itemname=${NM_SERVICE_DESC[${item}]}
@@ -752,23 +750,29 @@ DOWNLIST(){
toterrtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${ditem}.down)
fi
c=0; spc=''
spc1=${cw}-${#itemname}
c=0; spc=''; spc1=${cw}-${#itemname}
#echo "HERE: $downitem ~ $ditem ~ $host ~ $item ~ $itemname ~ $spc1"
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
c=0; spc2=''
spc1=${cw2}-${#itemname}-${#host}-${spc1}
c=0; spc2=''; spc1=${cw2}-${#itemname}-${#host}-${spc1}
until [ $c = ${spc1} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
echo -e "${idsCL[LightRed]}${idsST[Bold]}${ignsel}${idsST[Reset]}${idsCL[LightRed]}${itemname}${spc}${host}${spc2}$(SHOW_TIME ${toterrtime})${idsCL[Default]}"
if [ "${1}" != "ignore" ]; then
echo -e "${idsCL[LightRed]}${itemname}${spc}${host}${spc2}$(SHOW_TIME ${toterrtime})${idsCL[Default]}"
else
[ ${is} -lt 10 ] && ignsel=" ${is}) " || ignsel="${is}) "
[ -f ${NM_TMPFOLDER}/${ditem}.disable ] && dstatus="OFF" || dstatus="on"
time=$(SHOW_TIME ${toterrtime})
c=0; spc3=''; spc1=$13-${#time}
until [ $c = ${spc1} ]; do spc3="${spc3} "; c=`expr $c + 1`; done
echo -en "${idsCL[LightRed]}${idsST[Bold]}${ignsel}${idsST[Reset]}${idsCL[LightRed]}${itemname}${spc}${host}${spc2}${time}${spc3}${dstatus}${idsCL[Default]}"
fi
DIVIDER false darkGray 90
((is++))
done
echo
if [ "${1}" == "ignore" ]; then
IFS=$'\n'
read -rd '' -a DOWNLIST <<<"${DOWN_LIST}"
unset IFS
echo -en "${idsCL[LightCyan]}Enter # to change notifications: ${idsCL[Default]}"
read -n 1 choice