diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 753e1a48..b0813896 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -57,14 +57,30 @@ case "$1" in DEL_SITE=${2} echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}" echo "" - rm -f /etc/nginx/sites-available/${DEL_SITE}.conf - rm -f /etc/nginx/sites-enabled/${DEL_SITE}.conf - rm -rf /var/www/${DEL_SITE} - rm -rf /etc/letsencrypt/archive/${DEL_SITE} - rm -rf /etc/letsencrypt/live/${DEL_SITE} - rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf - echo -e "${idsCL[LightGreen]}Waiting for node replication...${idsCL[Default]}" - sleep 20 + + echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${2}]} ${ADISP}ing]]${idsCL[Default]}" + echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}" + + nid=1 + for nip in "${NODE_HOSTS[@]}" + do + if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then + nip='localhost' + NCMD='' + else + NCMD="ssh root@${nip}" + fi + echo -en "${ADISP}ing on iDS-Node${nid} ($nip)... ${idsCL[Default]}" + ${NCMD} rm -f /etc/nginx/sites-available/${DEL_SITE}.conf + ${NCMD} rm -f /etc/nginx/sites-enabled/${DEL_SITE}.conf + ${NCMD} rm -rf /var/www/${DEL_SITE} + ${NCMD} rm -rf /etc/letsencrypt/archive/${DEL_SITE} + ${NCMD} rm -rf /etc/letsencrypt/live/${DEL_SITE} + ${NCMD} rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf + echo -e "${idsCL[Green]}OK${idsCL[Default]}" + nid=`expr $nid + 1` + done + ${FOLDER}/nodemgmt-scripts.sh service nginx reload echo -e "${idsCL[LightRed]}Site has been deleted.${idsCL[Default]}" @@ -370,7 +386,7 @@ service) else NCMD="ssh root@${nip}" fi - echo -en "${ADISP}ing on Node ${nid} ($nip)...${idsCL[Default]}" + echo -en "${ADISP}ing on iDS-Node${nid} ($nip)... ${idsCL[Default]}" $NCMD systemctl $3 $2 if [[ "enable,disable" = *"${3}"* ]] || [ "${2}" = "daemon-reload" ]; then echo -e "${idsCL[Green]}OK${idsCL[Default]}"