From 457b4120ca7fd127190d3713287100a446809f03 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 29 Jan 2019 19:54:19 -0600 Subject: [PATCH] update --- defaults.inc | 16 ++++++++-------- nodemgmt-scripts.sh | 14 +++++++------- run.sh | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/defaults.inc b/defaults.inc index 4bb57e2e..38856929 100755 --- a/defaults.inc +++ b/defaults.inc @@ -10,11 +10,11 @@ NODE_HOSTS=(${NODE_HOSTS}) NODE_SERVICES=(${NODE_SERVICES}) unset IFS -declare -A idsNMservices -idsNMservices[mysql]='MySQL' -idsNMservices[nginx]='NGINX' -idsNMservices[gogs]='Gogs' -idsNMservices[gitea]='Gitea' -idsNMservices[haproxy]='HAProxy' -idsNMservices[keepalived]='Keepalived' -idsNMservices[maxscale]='MaxScale' +declare -A NM_SERVICES +NM_SERVICES['mysql']='MySQL' +NM_SERVICES['nginx']='NGINX' +NM_SERVICES['gogs']='Gogs' +NM_SERVICES['gitea']='Gitea' +NM_SERVICES['haproxy']='HAProxy' +NM_SERVICES['keepalived']='Keepalived' +NM_SERVICES['maxscale']='MaxScale' diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 506ac922..b734146d 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -18,14 +18,14 @@ case "$1" in echo -e "${idsCL[Red]}(${3}) is not an allowed service action.${idsCL[Default]}" exit 1 fi - if [ "${idsNMservices[${2}]}" = "" ]; then idsNMservices[${2}]="${srvc}"; fi + if [ "${NM_SERVICES[${2}]}" = "" ]; then NM_SERVICES[${2}]="${srvc}"; fi if [ "$3" = "stop" ]; then ADISP='Stopp'; elif [ "$3" = "enable" ]; then ADISP='Enabl'; elif [ "$3" = "disable" ]; then ADISP='Disabl'; else ADISP="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"; fi if [ "$3" = "start" ] && [ "$2" = "haproxy" ]; then TACT='restart'; else TACT="${3}"; fi - echo -e "${idsCL[LightGreen]}[[${idsNMservices[${srvc}]} ${ADISP}ing]]${idsCL[Default]}" + echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${srvc}]} ${ADISP}ing]]${idsCL[Default]}" echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}" nid=1 @@ -50,7 +50,7 @@ case "$1" in done echo "" - echo -e "${idsCL[Green]}${idsNMservices[${srvc}]} has been ${ADISP}ed${idsCL[Default]}" + echo -e "${idsCL[Green]}${NM_SERVICES[${srvc}]} has been ${ADISP}ed${idsCL[Default]}" echo "" exit 0 ;; @@ -110,8 +110,8 @@ case "$1" in for srvc in "${NODE_SERVICES[@]}" do - if [ "${idsNMservices[${srvc}]}" = "" ]; then idsNMservices[${srvc}]="${srvc}"; fi - echo -en "${idsNMservices[${srvc}]} " + if [ "${NM_SERVICES[${srvc}]}" = "" ]; then NM_SERVICES[${srvc}]="${srvc}"; fi + echo -en "${NM_SERVICES[${srvc}]} " if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then echo -e "${idsCL[Green]}Running${idsCL[Default]}" else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}" @@ -133,10 +133,10 @@ case "$1" in fi for srvc in "${NODE_SERVICES[@]}" do - if [ "${idsNMservices[${srvc}]}" = "" ]; then idsNMservices[${srvc}]="${srvc}"; fi + if [ "${NM_SERVICES[${srvc}]}" = "" ]; then NM_SERVICES[${srvc}]="${srvc}"; fi if [ "${STATUS_CHECK_EMAIL}" != "" ]; then if [ $(${NCMD} pgrep ${srvc} | wc -l) -lt "1" ]; then - echo "${idsNMservices[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL} + echo "${NM_SERVICES[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL} fi fi done diff --git a/run.sh b/run.sh index dc3f62b7..0755a8d3 100755 --- a/run.sh +++ b/run.sh @@ -14,8 +14,8 @@ if [ "$1" != "service" ] && [ "$1" != "status" ] && [ "$1" != "status-check" ]; echo -e "Node hostname: ${NODE_HOSTNAME}" for srvc in "${NODE_SERVICES[@]}" do - if [ "${idsNMservices[${srvc}]}" = "" ]; then idsNMservices[${srvc}]="${srvc}"; fi - echo -en "${idsNMservices[${srvc}]} " + if [ "${NM_SERVICES[${srvc}]}" = "" ]; then NM_SERVICES[${srvc}]="${srvc}"; fi + echo -en "${NM_SERVICES[${srvc}]} " if [ $(pgrep ${srvc} | wc -l) -gt "0" ]; then echo -e "${idsCL[Green]}Running${idsCL[Default]}" else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"