This commit is contained in:
2019-03-08 01:07:25 -06:00
parent 4729ecf20d
commit a241f5c84b
2 changed files with 49 additions and 4 deletions

View File

@@ -1349,8 +1349,8 @@ SERVICE(){
echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${1}]} ${NM_SRVCOPTS[${2}]}ing]]${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
nid=1
if [[ "${NODESERVICES_CHECK}" = *"${1}"* ]]; then
nid=1
for nip in "${NODE_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost '
@@ -1378,8 +1378,8 @@ SERVICE(){
nid=`expr $nid + 1`
done
fi
nid=1
if [[ "${WEBSERVICES_CHECK}" = *"${1}"* ]]; then
nid=1
for nip in "${WEB_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost '
@@ -1401,6 +1401,29 @@ SERVICE(){
nid=`expr $nid + 1`
done
fi
if [[ "${LBSERVICES_CHECK}" = *"${1}"* ]]; then
nid=1
for nip in "${LB_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost '
NCMD=''
else
NCMD="ssh root@${nip}"
fi
echo -en "${NM_SRVCOPTS[${2}]}ing on LB-Node${nid} ($nip)... ${idsCL[Default]}"
$NCMD systemctl $2 $1
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
elif [ "$2" = "stop" ]; then
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
else
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
nid=`expr $nid + 1`
done
fi
echo ""
echo -e "${idsCL[Green]}${NM_SERVICES[${1}]} has been ${NM_SRVCOPTS[${2}]}ed${idsCL[Default]}"
@@ -1449,6 +1472,25 @@ HAPROXY-CONFIG() {
nid=`expr $nid + 1`
done
fi
if [[ "${LBSERVICES_CHECK}" = *"haproxy"* ]]; then
nid=1
for nip in "${LB_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost '
NCMD=''
else
NCMD="ssh root@${nip}"
fi
echo -en "Creating File on LB-Node${nid} ($nip)... ${idsCL[Default]}"
${NCMD} "nodemgmt update q"
${NCMD} "rm -f /etc/haproxy/haproxy.cfg"
${NCMD} "sed -e 's;%NIP%;${nip};g' ${FOLDER}/templates/haproxy.config > /etc/haproxy/haproxy.cfg"
echo -e "${idsCL[Green]}COMPLETE${idsCL[Default]}"
nid=`expr $nid + 1`
done
fi
SERVICE haproxy reload
echo ""
echo -e "${idsCL[Green]}HAProxy Config Files have been created.${idsCL[Default]}"