diff --git a/inc/certs.inc b/inc/certs.inc index 40fb9503..c5ba69d4 100755 --- a/inc/certs.inc +++ b/inc/certs.inc @@ -630,4 +630,8 @@ CHECK-CERTS(){ done unset IFS fi -} \ No newline at end of file +} + + + + diff --git a/inc/sites.inc b/inc/sites.inc index 15f77176..11fe5df0 100755 --- a/inc/sites.inc +++ b/inc/sites.inc @@ -4,17 +4,16 @@ DELSITE(){ case "$1" in -site) DEL_SITE=${2};; -ssl) DEL_SSL=${2};; - -list) DELSITES; exit 0;; - -*) + -*) [ "${1}" != "-h" ] && echo "Invalid option: '${1}' requires an argument" 1>&2 echo -e "Usage: ${idsCL[Yellow]}[nodemgmt or nmg] delsite${idsCL[Default]} {" width=35 printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)" printf "%-${width}s- %s\n" " -ssl {yes or [no]}" "Delete SSL certs as well" printf "%-${width}s- %s\n" " -list" "List sites (same as running nodemgmt delsites)" - echo "}" - echo - exit 0;; + echo -e "}\n" + exit 0 + ;; esac shift done @@ -72,71 +71,6 @@ DELSITE(){ fi } -DELSITES(){ - echo - echo -e "${idsCL[Red]}Select a site to delete...${idsCL[Default]}" - DIVIDER true - sid=1 - # 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 - # for siteconf in "${NM_NGINXPATH}/sites-enabled/*" ; do - # [ -e "$siteconf" ] || continue - if [ ${siteconf:0:1} == '/' ]; then - IFS='/'; site_conf=(${siteconf}); unset IFS - [ "${site_conf[3]}" == "sites-enabled" ] && SITES[${sid}]=${site_conf[4]/.conf/} || [ "${site_conf[4]}" == "sites-enabled" ] && SITES[${sid}]=${site_conf[5]/.conf/} - sid=`expr $sid + 1` - fi - done - for s in "${!SITES[@]}"; do - echo -e " [${idsCL[Yellow]}${s}${idsCL[Default]}] ${SITES[${s}]}" - done - echo - if [ -z $action ] || [ "${action}" = "gui" ]; then - echo " [B] Back" - fi - echo " [Q] Quit" - echo - echo -en "${idsCL[LightYellow]}Please select a site from above from above:${idsCL[Default]} " - read selsite - echo - if [ -z ${SITES[$selsite]} ] && [ "${selsite}" != "Q" ] && [ "${selsite}" != "q" ] && [ "${selsite}" != "B" ] && [ "${selsite}" != "b" ]; then - echo "Thats an invaild option," - echo "please select a valid option only." - sleep 1 - DELSITES - exit 0 - elif [ "${selsite}" = "Q" ] || [ "${selsite}" = "q" ]; then - exit 0 - elif [ "${selsite}" = "B" ] || [ "${selsite}" = "b" ]; then - GUI - else - while : - do - echo -en "${idsCL[LightRed]}Are you sure you want to delete '${idsCL[Red]}${SITES[${selsite}]^^}${idsCL[LightRed]}'? [y/N]${idsCL[Default]} " - read response - echo - if [[ $response =~ ^[Yy]$ ]]; then - echo -en "${idsCL[LightRed]}Do you also want to delete the certs for '${idsCL[Red]}${SITES[${selsite}]^^}${idsCL[LightRed]}', if they exist? [y/N]${idsCL[Default]} " - read sslresponse - DELSITE -site ${SITES[${selsite}]} -ssl ${sslresponse} - echo - DIVIDER - ENTER2CONTINUE - break - else - break - fi - done - DELSITES - exit 0 - fi - if [ -z $action ] || [ "${action}" = "gui" ]; then - ENTER2CONTINUE - fi -} - NEWSITE(){ CERTTEST=0 echo @@ -746,6 +680,7 @@ SITEINFO(){ else #no site echo -e "\033[3A"; for (( c=1; c<=3; c++ )); do echo -e "\r\033[K"; done; echo -e "\033[4A" + [ "${siteid}" == "" ] && echo -e "\033[1A" fi done echo diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 89ca5e37..eaa1d170 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -1072,11 +1072,12 @@ GUI(){ echo -e " ${idsCL[Yellow]}sites${idsCL[Default]} - Manage NGINX Sites" echo -e " ${idsCL[Yellow]}newsite${idsCL[Default]} - Create a New Site" - echo -e " ${idsCL[Yellow]}delsite${idsCL[Default]} - Delete a Site" + echo -e " ${idsCL[Yellow]}delcert${idsCL[Default]} - Delete a Site" echo echo -e " ${idsCL[Yellow]}certs${idsCL[Default]} - Manage SSL Certificates" echo -e " ${idsCL[Yellow]}newcert${idsCL[Default]} - Generate New SSL Certificate" - echo -e " ${idsCL[Yellow]}delcert${idsCL[Default]} - Delete SSL Certificate" + echo -e " ${idsCL[Yellow]}delcert${idsCL[Default]} - Delete SSL Certificate" + echo echo -e " ${idsCL[Yellow]}certrenew${idsCL[Default]} - Renew all SSL Certificates" echo -e " ${idsCL[Yellow]}checkcerts${idsCL[Default]} - Check SSL Expirations" echo -e " ${idsCL[Yellow]}nightlyrenew${idsCL[Default]} - Renewal of SSL Certs, designed for cron tasks"