From d9fe2d7a345d0ccaa46c685e467baa97bbc9c021 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 12 Dec 2023 13:43:07 -0600 Subject: [PATCH] Update status.inc --- inc/status.inc | 70 ++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/inc/status.inc b/inc/status.inc index 9949f20a..9698ee60 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -3,47 +3,37 @@ STATUS(){ start=$(date +%s) log_start=$(date "+%Y-%m-%d %H:%M:%S") - # if [ "${1}" == "report" ] || [ "${1}" == "" ]; then - # STATUS_ACTION=${1} - # ntypesel=(${NM_NODE_TYPES[@]}) - # # if [ "${NM_NODETYPES[${STATUS_ACTION^^}]}" != "" ]; then - # # ntss=${STATUS_ACTION^^} - # # ntypesel=(${ntss}) - # # STATUS_ACTION=${2} - # # else - # # ntss="" - # # ntypesel=(${NM_NODE_TYPES[@]}) - # # [ "${1}" == "sync" ] && STATUS_ACTION=repl || STATUS_ACTION=${1} - # # fi - # else - # while [ $# -gt 0 ]; do - # case "$1" in - # -site) DEL_SITE=${2};; - # -ssl) DEL_SSL=${2};; - # -*) - # echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] status {opt}${idsCL[Default]} {" - # width=35 - # printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" - # printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" - # printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" - # printf "%-${width}s- %s\n" " -ssl {yes or [no]}" "Delete SSL certs as well" - # printf "%-${width}s- %s\n" " -list" "List sites (same as running nodemgmt delsites)" - # echo -e "}\n" - # exit 0 - # ;; - # esac - # shift - # done - # fi - if [ "${NM_NODETYPES[${1^^}]}" != "" ]; then - ntss=${1^^} - ntypesel=(${ntss}) - STATUS_ACTION=${2} - else - ntss="" - ntypesel=(${NM_NODE_TYPES[@]}) - [ "${1}" == "sync" ] && STATUS_ACTION=repl || STATUS_ACTION=${1} + if [ "${1}" != "-h" ]; then + if [ "${1}" != "" ] && [ "${NM_NODETYPES[${1^^}]}" != "" ]; then + ntss=${1^^} + ntypesel=(${ntss}) + STATUS_ACTION=${2} + else + ntss="" + ntypesel=(${NM_NODE_TYPES[@]}) + [ "${1}" == "sync" ] && STATUS_ACTION=repl || STATUS_ACTION=${1} + fi fi + while [ $# -gt 0 ]; do + case "$1" in + -site) DEL_SITE=${2};; + -ssl) DEL_SSL=${2};; + -h) + echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] status {opt}${idsCL[Default]} {" + width=35 + printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" + printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" + printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" + printf "%-${width}s- %s\n" " -ssl {yes or [no]}" "Delete SSL certs as well" + printf "%-${width}s- %s\n" " -list" "List sites (same as running nodemgmt delsites)" + echo -e "}\n" + exit 0 + ;; + esac + shift + done + + PRI_CW=40 declare -i cw; declare -i spc1; declare -i c