This commit is contained in:
2023-07-16 21:30:39 -05:00
parent 07608977bf
commit 33901363ab
4 changed files with 39 additions and 39 deletions

View File

@@ -43,22 +43,19 @@ DELSITE(){
echo -e "${idsCL[LightRed]}[[Removing Files and Folders]]${idsCL[Default]}"
echo -e "${idsCL[LightRed]}-------------------------------------------${idsCL[Default]}"
echo
echo -en "${idsCL[LightCyan]}Removing files from all Nodes ... ${idsCL[Default]}"
ssh root@10.10.1.120 rm -f /etc/nginx/sites-enabled/${DEL_SITE}* >/dev/null 2>&1
ssh root@10.10.10.80 rm -f /etc/nginx/sites-enabled/${DEL_SITE}* >/dev/null 2>&1
if [ "${DEL_SSL}" == "yes" ]; then
ssh root@10.10.10.80 rm -rf ${NM_CERTPATH}/archive/${DEL_SITE} >/dev/null 2>&1
ssh root@10.10.10.80 rm -rf ${NM_CERTPATH}/live/${DEL_SITE} >/dev/null 2>&1
ssh root@10.10.10.80 rm -f ${NM_CERTPATH}/renewal/${DEL_SITE}.conf >/dev/null 2>&1
fi
echo -en "${idsCL[LightCyan]}Removing NGINX files ... ${idsCL[Default]}"
rm -f ${NM_NGINXPATH}/sites-enabled/${DEL_SITE}* >/dev/null 2>&1
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
echo
if [ "${DEL_SSL}" == "yes" ]; then
DEL-SSL ${DEL_SITE}
echo
fi
ssh root@${NM_SINGLESRVR_IP['WEB']} sed -i "/${DEL_SITE}/d" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml
echo -en "${idsCL[LightCyan]}Reloading NGINX ... ${idsCL[Default]}"
ssh root@10.10.10.80 nodemgmt service nginx reload >/dev/null 2>&1
ssh root@10.10.1.120 nodemgmt service nginx reload >/dev/null 2>&1
SERVICE nginx reload >/dev/null 2>&1
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
# nid=1
@@ -74,9 +71,9 @@ DELSITE(){
# checkhost=$(CHECK_HOST ${nip})
# fi
# if [ "${checkhost}" != "false" ]; then
# #if [ -f /etc/nginx/sites-available/${DEL_SITE} ]; then
# ${NCMD} rm -f /etc/nginx/sites-available/${DEL_SITE}*
# ${NCMD} rm -f /etc/nginx/sites-enabled/${DEL_SITE}*
# #if [ -f ${NM_NGINXPATH}/sites-available/${DEL_SITE} ]; then
# ${NCMD} rm -f ${NM_NGINXPATH}/sites-available/${DEL_SITE}*
# ${NCMD} rm -f ${NM_NGINXPATH}/sites-enabled/${DEL_SITE}*
# #fi
# #if [ -d /var/www/${DEL_SITE} ]; then
# ${NCMD} rm -rf /var/www/${DEL_SITE}
@@ -113,10 +110,10 @@ DELSITES(){
echo -e "${idsCL[Red]}Select a site to delete...${idsCL[Default]}"
DIVIDER true
sid=1
filels="( $(ssh root@${WEB_HOSTS[0]} ls '/etc/nginx/sites-available/*') )"
filels="( $(ssh root@${WEB_HOSTS[0]} ls '${NM_NGINXPATH}/sites-available/*') )"
# IFS='\n'
for siteconf in $filels; do
# for siteconf in /etc/nginx/sites-available/* ; do
# for siteconf in ${NM_NGINXPATH}/sites-available/* ; do
# [ -e "$siteconf" ] || continue
if [ ${siteconf:0:1} == '/' ]; then
IFS='/'; site_conf=(${siteconf}); unset IFS
@@ -324,7 +321,7 @@ NEWSITE(){
NGINX_SERVERNAME=${NEW_SITE}
fi
nginxconfig=/etc/nginx/sites-enabled/${MAIN_SITE}.conf
nginxconfig=${NM_NGINXPATH}/sites-enabled/${MAIN_SITE}.conf
if [ "${SITE_TYPE}" = "proxy" ]; then
if [ ! -z ${PROXYSCHEME+x} ] && [ ! -z ${PROXYHOST+x} ] && [ ! -z ${PROXYPORT+x} ]; then GO=true; fi
@@ -438,10 +435,10 @@ NEWSITE(){
rm -f ${NM_FOLDER}/new-site.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_SITE}\n${daterun}" > ${NM_FOLDER}/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun /etc/nginx/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun ${NM_NGINXPATH}/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun /var/www/new-site.lastrun
# daterun=`date +%Y-%m-%d-%H-%M-%S`
# echo -e "${daterun}" >> /etc/nginx/new-site.lastrun
# echo -e "${daterun}" >> ${NM_NGINXPATH}/new-site.lastrun
DIVIDER true
echo
echo -e "${idsCL[LightGreen]}The new site for '${idsCL[LightGreen]}${NEW_SITE}${idsCL[Default]}' has been created.${idsCL[Default]}"