Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-05 22:24:30 -06:00
parent 23afa04674
commit febe3dc044

View File

@@ -176,8 +176,24 @@ BACKUP(){
}
DELSITE(){
if [ ! -z ${1+x} ]; then
DEL_SITE=${1}
while [ $# -gt 0 ]; do
case "$1" in
-site) DEL_SITE=${2};;
-ssl) DEL_SSL=${2};;
-*)
echo "Invalid option: '${1}' requires an argument" 1>&2
echo ""
echo -e "Usage: ${idsCL[Yellow]}nodemgmt delsite${idsCL[Default]} {"
width=33
printf "%-${width}s- %s\n" " -site {FQDN address}" "(*required)"
printf "%-${width}s- %s\n" " -ssl {yes or [no]}" "Delete SSL certs as well"
echo "}"
exit 1;;
esac
shift
done
if [ -z ${DEL_SSL+x} ]; then DEL_SSL=no; fi
if [ ! -z ${DEL_SITE+x} ]; then
echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}"
echo ""
@@ -201,10 +217,12 @@ DELSITE(){
if [ -d /var/www/${DEL_SITE} ]; then
${NCMD} rm -rf /var/www/${DEL_SITE}
fi
if [ -d /etc/letsencrypt/archive/${DEL_SITE} ]; then
${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
if [ "${DEL_SSL}" = "yes" ]; then
if [ -d /etc/letsencrypt/archive/${DEL_SITE} ]; then
${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
fi
fi
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
nid=`expr $nid + 1`
@@ -255,7 +273,7 @@ DELSITES(){
read response
echo ""
if [[ $response =~ ^[Yy]$ ]]; then
echo -e -n "${idsCL[LightRed]}Do you also want to delete the certs for '${SITES[${selsite}]}' as well?${idsCL[Default]} "
echo -e -n "${idsCL[LightRed]}Do you also want to delete the certs for '${SITES[${selsite}]}' as well? [y/N]${idsCL[Default]} "
read sslresponse
echo "delete - '${sslresponse}'"
ENTER2CONTINUE
@@ -607,7 +625,7 @@ if [ ${action-x} ]; then
certrenew) CERTRENEW;;
listcerts) LISTCERTS;;
nightlyrenew) NIGHTLYRENEW;;
delsite) DELSITE ${2};;
delsite) DELSITE ${2} ${3} ${4} ${5};;
delsites) DELSITES;;
newsite) NEWSITE ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14};;
update) ;;