From 699e62d6d11746870dfffb90a6fee322e587fe0a Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 18 Nov 2023 19:14:32 -0600 Subject: [PATCH] Update services.inc --- inc/services.inc | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/inc/services.inc b/inc/services.inc index 8c9e3d0e..68c0df1c 100755 --- a/inc/services.inc +++ b/inc/services.inc @@ -94,6 +94,17 @@ SERVICE_MGMT(){ -nt|-nodetype) SERVICE['nodetype']=${2^^};; -a|-action) SERVICE['action']=${2,,};; -q|-quiet) QUIET=1;; + -h|-help) + echo -e "\nUsage: ${idsCL[Yellow]}[nodemgmt or nmg] ${idsCL[LightYellow]}service${idsCL[Default]} {" + width=35 + printf "%-${width}s- %s\n" " -s|-service {service}" "Name of service to manage" + printf "%-${width}s- %s\n" " -n|-node {node-lan-ip}" "Node to run on" + printf "%-${width}s- %s\n" " -nt|-nodetype {nodetype}" "NodeType to run on, or all. Defaults to local nodetype" + printf "%-${width}s- %s\n" " -a|-action {action}" "Action to perform; start, stop, restart etc" + printf "%-${width}s- %s\n" " -q|-quiet" "Do not output, typically used from cron jobs" + echo -e "}\n" + exit 0 + ;; *) if [ "${NM_SERVICE_DESC[${1}]}" != "" ]; then SERVICE['service']=${1} @@ -107,19 +118,6 @@ SERVICE_MGMT(){ elif [ "${1}" == "q" ]; then QUIET=1 - else - echo - [ "${1}" != "-h" ] && echo -e "Invalid command\n" - echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] ${idsCL[LightYellow]}service${idsCL[Default]} {" - width=35 - printf "%-${width}s- %s\n" " -s|-service {service}" "Name of service to manage" - printf "%-${width}s- %s\n" " -n|-node {node-lan-ip}" "Node to run on" - printf "%-${width}s- %s\n" " -nt|-nodetype {nodetype}" "NodeType to run on, or all. Defaults to local nodetype" - printf "%-${width}s- %s\n" " -a|-action {action}" "Action to perform; start, stop, restart etc" - printf "%-${width}s- %s\n" " -q|-quiet" "Do not output, typically used from cron jobs" - echo -e "}\n" - exit 0 - fi ;; esac