From 74407bc1b24ee60ccfb9804a8908825ab7a4aa74 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 26 Mar 2019 22:39:01 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 61 +++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index ce282e22..0c15a180 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -36,49 +36,23 @@ STATUS(){ echo -e "${idsCL[LightCyan]}Setting up status checks...${idsCL[Default]}" echo fi - # if [ ! -z ${LOCAL_SERVICES+x} ]; then - NHCMD="ssh root@${MYSQL_HOSTS[0]}" - LBHCMD="ssh root@${LB_HOSTS[0]}" - WHCMD="ssh root@${WEB_HOSTS[0]}" - # echo "HERE: '${NHCMD}' '${WHCMD}'" - # else - # NHCMD='' - # fi - if [ ! -z ${MYSQL_REPL_CHECK+x} ]; then - for rcheck in "${MYSQL_REPL_CHECK[@]}"; do - ${NHCMD} rm -f ${FOLDER}/test.repl - daterun=`date +%Y-%m-%d-%H-%M-%S` - if [ "${NHCMD}" = "" ]; then - echo -e "MySQL-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl - yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl - else - ${NHCMD} "echo -e \"Status-Check (${NODE_HOSTNAME})\n${daterun}\" > ${FOLDER}/test.repl" - yes | ${NHCMD} "cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl" - fi - done - fi - if [ ! -z ${LB_REPL_CHECK+x} ]; then - for rcheck in "${LB_REPL_CHECK[@]}"; do - ${LBHCMD} rm -f ${FOLDER}/test.repl - daterun=`date +%Y-%m-%d-%H-%M-%S` - if [ "${LBHCMD}" = "" ]; then - echo -e "LB-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl - yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl - else - ${LBHCMD} "echo -e \"Status-Check (${NODE_HOSTNAME})\n${daterun}\" > ${FOLDER}/test.repl" - yes | ${LBHCMD} "cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl" - fi - done - fi - for rcheck in "${WEB_REPL_CHECK[@]}"; do - ${WHCMD} rm -f ${FOLDER}/test.repl - daterun=`date +%Y-%m-%d-%H-%M-%S` - if [ "${WHCMD}" = "" ]; then - echo -e "Webserver-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl - yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl - else - ${WHCMD} "echo -e \"Status-Check (${NODE_HOSTNAME})\n${daterun}\" > ${FOLDER}/test.repl" - yes | ${WHCMD} "cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl" + NHCMD="ssh root@${MYSQL_HOSTS[0]}" + LBHCMD="ssh root@${LB_HOSTS[0]}" + WHCMD="ssh root@${WEB_HOSTS[0]}" + for NTYPE in "${NODE_TYPES[@]}"; do + var=${NTYPE}_REPL_CHECK[@] + if [ ! -z ${!var+x} ]; then + for rcheck in "${!var}"; do + ${NHCMD} rm -f ${FOLDER}/test.repl + daterun=`date +%Y-%m-%d-%H-%M-%S` + if [ "${NHCMD}" = "" ]; then + echo -e "${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl + yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl + else + ${NHCMD} "echo -e \"Status-Check (${NODE_HOSTNAME})\n${daterun}\" > ${FOLDER}/test.repl" + yes | ${NHCMD} "cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl" + fi + done fi done if [ "${ST_ACTION}" = "repl" ]; then @@ -86,7 +60,6 @@ STATUS(){ fi fi ######################## - if [ "${ST_ACTION}" = "" ] || [ "${ST_ACTION}" = "report" ] || [ "${ST_ACTION}" = "services" ] || [ "${ST_ACTION}" = "check" ]; then if [ ! -z ${LOCAL_SERVICES+x} ]; then if [ "${ST_ACTION}" != "check" ]; then