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(){
RUNCMD=''
while [ $# -gt 0 ]; do
case "${1}" in
-nt|-nodetype) nodetype=${2^^};;
*) RUNCMD="${RUNCMD}${1} ";;
-cmd) RUNCMD="${2}";;
esac
shift
done
echo "NODETYPE= '${nodetype}'"
echo "RUNCMD= '${RUNCMD}'"
# for NTYPE in "${NM_NODE_TYPES[@]}"; do
# echo -e "${idsST[Bold]}"; DIVIDER
# RUNCMD=''
# for i in {1..14}; do
# [ "${i}" != "1" ] && [ "${!i}" != "" ] && RUNCMD="${RUNCMD} "
# [ "${!i}" != "" ] && RUNCMD="${RUNCMD}${!i}"
# done
# echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Nodes to run command { \`${RUNCMD}\` }${idsCL[Default]}"
# DIVIDER; echo -e "${idsST[Reset]}"
#
# var=${NTYPE}_HOSTS[@]
# for nip in "${!var}"; do
# if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
# 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
if [ "${nodetype}" == "ALL" ] || ; then
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 nip in "${!NT_HOSTS}"; do
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
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(){