update
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
VERS='4.12.22-09142023'
|
||||
VERS='4.12.24-09142023'
|
||||
|
||||
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense '
|
||||
CERT_DAEMON='/snap/bin/certbot'
|
||||
|
||||
@@ -39,7 +39,7 @@ NEWCERT(){
|
||||
else
|
||||
echo
|
||||
echo -en "${idsCL[LightYellow]}Waiting for Cert replication across the nodes... ${idsCL[Default]}"
|
||||
for nip in "${LB_HOSTS[@]}"; do
|
||||
for nip in "${NM_HOSTS['LB'][@]}"; do
|
||||
checkhost=$(CHECK_HOST ${nip})
|
||||
if [ "${checkhost}" != "false" ]; then
|
||||
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
|
||||
@@ -68,7 +68,7 @@ NEWCERT(){
|
||||
|
||||
# echo
|
||||
# echo -en "${idsCL[LightYellow]}Starting other Webservers... ${idsCL[Default]}"
|
||||
# for nip in "${WEB_HOSTS[@]}"; do
|
||||
# for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
# if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
|
||||
# `ssh root@${nip} service nginx start`
|
||||
# # SERVICE nginx start ${nip}
|
||||
@@ -185,7 +185,7 @@ LISTCERTS(){
|
||||
done
|
||||
unset IFS
|
||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
||||
NCMD="ssh root@${LB_HOSTS[0]}"
|
||||
NCMD="ssh root@${NM_HOSTS['LB'][0]}"
|
||||
#${NCMD} rm -f /tmp/ssllist
|
||||
#${NCMD} 'for certdir in ${NM_CERTPATH}/live/*/ ; do echo $certdir; done' > /tmp/ssllist
|
||||
else
|
||||
|
||||
@@ -141,7 +141,7 @@ SERVICE(){
|
||||
if [[ " ${NC_HOSTS[*]} " =~ " ${nip} " ]]; then
|
||||
mntpath="/mnt/Nextcloud-Data"
|
||||
# elif [[ "${WEBHOSTS}" == *"${nip}"* ]]; then
|
||||
elif [[ " ${WEB_HOSTS[*]} " =~ " ${nip} " ]]; then
|
||||
elif [[ " ${NM_HOSTS['WEB'][*]} " =~ " ${nip} " ]]; then
|
||||
mntpath="/mnt/web-data"
|
||||
fi
|
||||
${NCMD} "test -e ${mntpath}/mounted"
|
||||
|
||||
@@ -59,7 +59,7 @@ DELSITE(){
|
||||
# echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||
|
||||
# nid=1
|
||||
# for nip in "${WEB_HOSTS[@]}"; do
|
||||
# for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
# if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
|
||||
# nip='localhost '
|
||||
# NCMD=''
|
||||
@@ -110,7 +110,7 @@ DELSITES(){
|
||||
echo -e "${idsCL[Red]}Select a site to delete...${idsCL[Default]}"
|
||||
DIVIDER true
|
||||
sid=1
|
||||
# filels="( $(ssh root@${LB_HOSTS[0]} ls ${NM_NGINXPATH}/sites-enabled/*) )"
|
||||
# filels="( $(ssh root@${NM_HOSTS['LB'][0]} ls ${NM_NGINXPATH}/sites-enabled/*) )"
|
||||
filels="( $(ls ${NM_NGINXPATH}/sites-enabled/*) )"
|
||||
# IFS='\n'
|
||||
for siteconf in $filels; do
|
||||
@@ -174,7 +174,7 @@ LISTSITES(){
|
||||
echo
|
||||
echo -e "${idsCL[Red]}NGINX Site Config...${idsCL[Default]}"
|
||||
DIVIDER true
|
||||
# filels="( $(ssh root@${LB_HOSTS[0]} ls ${NM_NGINXPATH}/sites-enabled/*) )"
|
||||
# filels="( $(ssh root@${NM_HOSTS['LB'][0]} ls ${NM_NGINXPATH}/sites-enabled/*) )"
|
||||
filels="( $(ls ${NM_NGINXPATH}/sites-enabled/*) )"
|
||||
for siteconf in $filels; do
|
||||
if [ ${siteconf:0:1} == '/' ]; then
|
||||
@@ -418,7 +418,7 @@ NEWSITE(){
|
||||
|
||||
sudo -u www-data mkdir -p /var/www/${MAIN_SITE}/{public_html,nginx_logs}
|
||||
# echo -en "${idsCL[LightYellow]}Waiting for folder replication across the webserver nodes... ${idsCL[Default]}"
|
||||
# for nip in "${WEB_HOSTS[@]}"; do
|
||||
# for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
# checkhost=$(CHECK_HOST ${nip})
|
||||
# if [ "${checkhost}" != "false" ]; then
|
||||
# if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
|
||||
@@ -478,7 +478,7 @@ NEWSITE(){
|
||||
else
|
||||
# echo
|
||||
# echo -en "${idsCL[LightYellow]}Verifying '${NEW_SITE}' replication across the nodes... ${idsCL[Default]}"
|
||||
# for nip in "${LB_HOSTS[@]}"; do
|
||||
# for nip in "${NM_HOSTS['LB'][@]}"; do
|
||||
# checkhost=$(CHECK_HOST ${nip})
|
||||
# if [ "${checkhost}" != "false" ]; then
|
||||
# if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
|
||||
|
||||
@@ -177,7 +177,7 @@ STATUS(){
|
||||
srvctst=(`${NCMD} "systemctl is-active ${srvcstotest}"`)
|
||||
sr=0
|
||||
for srvc in "${!srvcs}"; do
|
||||
[ "${srvc}" == "gitea" ] && [ "${NTYPE}" == "WEB" ] && [[ $($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *${WEB_HOSTS[0]}* ]] && NOGOCHK=false || NOGOCHK=true
|
||||
[ "${srvc}" == "gitea" ] && [ "${NTYPE}" == "WEB" ] && [[ $($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *${NM_SINGLESRVR_IP['WEB']}* ]] && NOGOCHK=false || NOGOCHK=true
|
||||
[ "${srvc}" == "keepalived" ] && [ "${nip}" == "10.2.1.2" ] && NOGOCHK=false
|
||||
if [ ${NOGOCHK} == true ]; then
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
@@ -332,6 +332,9 @@ STATUS(){
|
||||
for docker in "${!dockers}"; do
|
||||
[ "${NTYPE}" == "WEB" ] && ([ "${docker}" == "vaultwarden" ] || [ "${docker}" == "heimdall" ] || [ "${docker}" == "authelia" ]) && [[ $($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *${NM_SINGLESRVR_IP['WEB']}* ]] && NOGOCHK=false || NOGOCHK=true
|
||||
[ "${NTYPE}" == "LPD" ] && [ "${docker}" == "uptime-kuma" ] && [[ $($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *10.2.1.2* ]] && NOGOCHK=false || NOGOCHK=true
|
||||
|
||||
echo "HERE: "
|
||||
|
||||
if [ ${NOGOCHK} == true ]; then
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
if [ "${ST_ACTION}" != "report" ]; then
|
||||
@@ -346,13 +349,13 @@ STATUS(){
|
||||
|
||||
if [ ! "$(${NCMD} docker ps -q -f name=${docker})" ]; then
|
||||
if [ "$(${NCMD} docker ps -a | grep ${docker})" ]; then
|
||||
${NCMD} docker start ${docker} >/dev/null 2>&1
|
||||
# ${NCMD} docker start ${docker} >/dev/null 2>&1
|
||||
echo "$(date) - ${nip} - ${NM_HOSTNAMES[${nip}]}[${nip}] - ${NM_DOCKER_DESC[${docker}]} (docker) is not running, starting now" >> ${NM_LOGFILE}
|
||||
else
|
||||
${NCMD} /usr/local/bin/docker compose -f ${NM_DOCKER_COMPOSE_LOC[${docker}]}/docker compose.yml up -d >/dev/null 2>&1
|
||||
# ${NCMD} /usr/local/bin/docker compose -f ${NM_DOCKER_COMPOSE_LOC[${docker}]}/docker compose.yml up -d >/dev/null 2>&1
|
||||
echo "$(date) - ${nip} - ${NM_HOSTNAMES[${nip}]}[${nip}] - ${NM_DOCKER_DESC[${docker}]} (docker) is not found, creating and starting now" >> ${NM_LOGFILE}
|
||||
fi
|
||||
sleep 10s
|
||||
# sleep 10s
|
||||
if [ "$(${NCMD} docker ps -q -f name=${docker})" ]; then
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -e "${idsCL[Green]}Running - Fixed${idsCL[Default]}"
|
||||
@@ -551,9 +554,9 @@ It was down for $(SHOW_TIME ${toterrtime})"
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -en "${idsCL[LightCyan]} Cleaning up status checks... ${idsCL[Default]}"
|
||||
fi
|
||||
#NHCMD="ssh root@${MYSQL_HOSTS[0]}"
|
||||
#LBHCMD="ssh root@${LB_HOSTS[0]}"
|
||||
#WHCMD="ssh root@${WEB_HOSTS[0]}"
|
||||
#NHCMD="ssh root@${NM_HOSTS['MYSQL'][0]}"
|
||||
#LBHCMD="ssh root@${NM_HOSTS['LB'][0]}"
|
||||
#WHCMD="ssh root@${NM_HOSTS['WEB'][0]}"
|
||||
for NTYPE in "${NM_NODE_TYPES[@]}"; do
|
||||
PH=${NTYPE}_HOSTS[0]
|
||||
if [ ! -f ${NM_FOLDER}/${!PH}.down ]; then
|
||||
|
||||
@@ -53,7 +53,7 @@ BACKUP(){
|
||||
SET-PERMISSIONS(){
|
||||
if [ "${1}" = "gitea" ]; then
|
||||
nid=1
|
||||
for nip in "${WEB_HOSTS[@]}"; do
|
||||
for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||
NCMD=''
|
||||
else
|
||||
@@ -78,7 +78,7 @@ SET-PERMISSIONS(){
|
||||
done
|
||||
elif [ "${1}" = "pdnsadmin" ]; then
|
||||
nid=1
|
||||
for nip in "${WEB_HOSTS[@]}"; do
|
||||
for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||
NCMD=''
|
||||
else
|
||||
@@ -149,7 +149,7 @@ SET-PERMISSIONS(){
|
||||
fi
|
||||
nid=1
|
||||
[ "${NM_WWWPATHS['WEB']}" != "" ] && WWWPATH=${NM_WWWPATHS['WEB']} || WWWPATH=/var/www
|
||||
for nip in "${WEB_HOSTS[@]}"; do
|
||||
for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
checkhost=$(CHECK_HOST ${nip})
|
||||
if [ "${checkhost}" != "false" ]; then
|
||||
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||
@@ -218,7 +218,7 @@ HAPROXY-CONFIG() {
|
||||
# if [[ "${WEBSERVICES_CHECK}" = *"haproxy"* ]]; then
|
||||
if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " haproxy " ]]; then
|
||||
nid=1
|
||||
for nip in "${WEB_HOSTS[@]}"; do
|
||||
for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
@@ -289,7 +289,7 @@ KEEPALIVE-CONFIG() {
|
||||
# if [[ "${WEBSERVICES_CHECK}" = *"keepalive"* ]]; then
|
||||
if [[ " ${WEB_SERVICES_CHECK[*]} " =~ " keepalived " ]]; then
|
||||
nid=1
|
||||
for nip in "${WEB_HOSTS[@]}"; do
|
||||
for nip in "${NM_HOSTS['WEB'][@]}"; do
|
||||
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
|
||||
nip='localhost '
|
||||
NCMD=''
|
||||
|
||||
Reference in New Issue
Block a user