Update nodemgmt-scripts.sh

This commit is contained in:
2024-12-01 18:25:38 -06:00
parent 8ee58ffaeb
commit 32bb943ec6

View File

@@ -771,41 +771,43 @@ BACKUP_UNIFINVR(){
} }
RUN_COMMAND(){ RUN_COMMAND(){
RUNCMD=''
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "${1}" in case "${1}" in
-nt|-nodetype) nodetype=${2^^};; -nt|-nodetype) nodetype=${2^^};;
*) RUNCMD="${RUNCMD}${1} ";; -cmd) RUNCMD="${2}";;
esac esac
shift shift
done done
echo "NODETYPE= '${nodetype}'" if [ "${nodetype}" == "ALL" ] || ; then
echo "RUNCMD= '${RUNCMD}'" NT_HOSTS=ALL_HOSTS[@]
NTS=(${NM_NODE_TYPES[*]})
elif [ "${nodetype}" != "" ]; then
if [ "${NM_HOSTS[${nodetype}]}" != "" ]; then
NT_HOSTS=${nodetype}_HOSTS[@]
NTS=("${nodetype}");
else
echo -e "${idsCL[Red]}"${nodetype}" is an unknown NodeType.${idsCL[Default]}"
exit 1
fi
fi
for NTYPE in "${NTS[@]}"; do
echo -e "${idsST[Bold]}"; DIVIDER
echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}"
DIVIDER; echo -e "${idsST[Reset]}"
# for NTYPE in "${NM_NODE_TYPES[@]}"; do for nip in "${!NT_HOSTS}"; do
# echo -e "${idsST[Bold]}"; DIVIDER if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
# RUNCMD='' else NCMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${nip}"; LH=''
# for i in {1..14}; do fi
# [ "${i}" != "1" ] && [ "${!i}" != "" ] && RUNCMD="${RUNCMD} " echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_HOSTNAMES[${nip}]}[${nip}]${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYellow]}${LH}${idsCL[Default]}"
# [ "${!i}" != "" ] && RUNCMD="${RUNCMD}${!i}" DIVIDER false green
# done echo "Running command: ${NCMD} ${RUNCMD}"
# echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}" #${NCMD} "${RUNCMD}"
# DIVIDER; echo -e "${idsST[Reset]}" DIVIDER false green
# echo
# var=${NTYPE}_HOSTS[@] done
# for nip in "${!var}"; do echo
# if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost' done
# else NCMD="ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 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
# #echo "Running command: ${NCMD} ${RUNCMD}"
# ${NCMD} "${RUNCMD}"
# DIVIDER false green
# echo
# done
# echo
# done
} }
DOWNLIST(){ DOWNLIST(){