From ca5aef6e227538e48450c1f04da58c69ec3e796b Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 23 Jul 2022 16:56:52 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 0cc16921..7fc39414 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -1432,6 +1432,33 @@ SERVICE(){ fi fi fi + + elif [ "${1}" = "apache2" ]; then + if [ "${2}" = "restart" ] || [ "${2}" = "reload" ]; then + if [ "${3}" != "ns" ]; then + if [ "${3}" != "q" ]; then + echo -en "${idsCL[LightYellow]}Verifying Apache config and ssl cert replication across the nodes... ${idsCL[Default]}" + fi + if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${!NT_HOST}"* ]]; then + PH_CMD="ssh root@localhost" + else + PH_CMD="ssh root@${!NT_HOST}" + fi + ${PH_CMD} "echo -e \"Service ${1} ${2}\" > /etc/apache2/test.repl" + for nip in "${!NT_HOSTS}"; do + checkhost=$(CHECK_HOST ${nip}) + if [ "${checkhost}" != "false" ]; then + if [ "${nip}" != "${!NT_HOST}" ]; then + checked=false + until [ "${checked}" = "" ]; do + checked="`${PH_CMD} \"ssh root@${nip} 'if [ -f /etc/apache2/test.repl ]; then cat /etc/apache2/test.repl; fi' | diff - /etc/apache2/test.repl\"`" + done + fi + fi + done + ${PH_CMD} rm -f /etc/apache2/test.repl + fi + fi fi if [ "${3}" != "q" ]; then echo -e "${idsCL[Green]}Completed${idsCL[Default]}"