Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-03 22:33:23 -06:00
parent f54dbade12
commit c6e67be39d

View File

@@ -94,35 +94,45 @@ NIGHTLYRENEW(){
} }
DELSITE(){ DELSITE(){
DEL_SITE=${1} if [ ! -z ${1+x} ]; then
echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}" DEL_SITE=${1}
echo "" echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}"
echo ""
echo -e "${idsCL[LightRed]}[[Removing Files and Folders]]${idsCL[Default]}" echo -e "${idsCL[LightRed]}[[Removing Files and Folders]]${idsCL[Default]}"
echo -e "${idsCL[LightRed]}-------------------------------------------${idsCL[Default]}" echo -e "${idsCL[LightRed]}-------------------------------------------${idsCL[Default]}"
nid=1 nid=1
for nip in "${NODE_HOSTS[@]}" for nip in "${NODE_HOSTS[@]}"
do do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then
nip='localhost ' nip='localhost '
NCMD='' NCMD=''
else else
NCMD="ssh root@${nip}" NCMD="ssh root@${nip}"
fi fi
echo -en "Removing from iDS-Node${nid} ($nip)... ${idsCL[Default]}" echo -en "Removing from iDS-Node${nid} ($nip)... ${idsCL[Default]}"
${NCMD} rm -f /etc/nginx/sites-available/${DEL_SITE}.conf if [ -f /etc/nginx/sites-available/${DEL_SITE}.conf ]; then
${NCMD} rm -f /etc/nginx/sites-enabled/${DEL_SITE}.conf ${NCMD} rm -f /etc/nginx/sites-available/${DEL_SITE}.conf
${NCMD} rm -rf /var/www/${DEL_SITE} ${NCMD} rm -f /etc/nginx/sites-enabled/${DEL_SITE}.conf
${NCMD} rm -rf /etc/letsencrypt/archive/${DEL_SITE} fi
${NCMD} rm -rf /etc/letsencrypt/live/${DEL_SITE} if [ -d /var/www/${DEL_SITE} ]; then
${NCMD} rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf ${NCMD} rm -rf /var/www/${DEL_SITE}
echo -e "${idsCL[Green]}OK${idsCL[Default]}" fi
nid=`expr $nid + 1` if [ -d /etc/letsencrypt/archive/${DEL_SITE} ]; then
done ${NCMD} rm -rf /etc/letsencrypt/archive/${DEL_SITE}
echo "" ${NCMD} rm -rf /etc/letsencrypt/live/${DEL_SITE}
${FOLDER}/nodemgmt-scripts.sh service nginx reload ${NCMD} rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf
echo -e "${idsCL[LightRed]}Site has been deleted.${idsCL[Default]}" fi
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
nid=`expr $nid + 1`
done
echo ""
${FOLDER}/nodemgmt-scripts.sh service nginx reload
echo -e "${idsCL[LightRed]}Site has been deleted.${idsCL[Default]}"
else
echo -e "${idsCL[LightRed]}No site was defined.${idsCL[Default]}"
fi
} }
NEWSITE(){ NEWSITE(){