From 9ed5ed27f1ab07dd0ba83ff1e93b737643aa7260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Wed, 1 May 2019 14:10:19 -0600 Subject: [PATCH] fixes last minute fixes before release. --- lib/api-events_sample | 58 ++++--------------------------------------- lib/site-ssl | 6 ++--- lib/sites | 2 +- plugins/site | 13 +++------- 4 files changed, 12 insertions(+), 67 deletions(-) diff --git a/lib/api-events_sample b/lib/api-events_sample index a318f12..b4abfb2 100644 --- a/lib/api-events_sample +++ b/lib/api-events_sample @@ -1,60 +1,12 @@ #!/bin/bash -# Installation process -# -# i1 - Common Packages -# i2 - Common Packages Finished -# -# in1 - NGINX Installation -# in2 - NGINX Installation Finished -# in3 - NGINX Optimization -# in4 - Ubuntu Optimization -# in5 - SWAP Creation -# in6 - SWAP Creation Finished -# in7 - Ubuntu Optimization Finished -# in8 - NGINX Optimization Finished -# in9 - NGINX Tools -# in10 - NGINX Tools Finished -# -# ip1 - PHP Installation -# ip2 - PHP Installation Finished -# ip3 - PHP Optimization -# ip4 - PHP Optimization Finished -# ip5 - PHP Tools -# ip6 - PHP Tools site creation -# ip7 - PHP Tools site creation Finished -# ip8 - PHP Tools Finished -# -# im1 - MySQL Installation -# im2 - MySQL Client Installation -# im3 - MySQL Client Installation Finished -# im4 - MySQL Installation Finished -# im5 - MySQL Tool (PhpMyAdmin) -# im6 - MySQL Tool (PhpMyAdmin) Finished -# -# -# Purge (UnInstall) -# -# pn1 - NGINX Purge -# pn2 - NGINX Delete All Sites -# pn3 - NGINX Delete All Sites Finished -# pn4 - NGINX Purge Finished -# pn5 - NGINX Purge Tools -# pn6 - NGINX Purge Tools Finished -# pn7 - Ubuntu Optimization Purge -# pn8 - Ubuntu Optimization Purge Finished -# pn9 - SWAP Purge -# pn10 - SWAP Purge Finished -# -# pp1 - PHP Purge -# pp2 - PHP Purge Finished -# -# pm1 - MySQL Purge -# pm2 - MySQL Tool (PhpMyAdmin) Purge -# pm3 - MySQL Tool (PhpMyAdmin) Purge Finished -# pm4 - MySQL Purge Finished +# Internal API or Events +# Docs: https://webinoly.com/en/documentation/internal-api-events/ +# Description: Execute actions at certain points or events, for example at the end of the "stack" command each time is executed +# or after Nginx is installed. Just rename this file to "api-events" and check for the complete list of status codes in the documentation. +# Just put all your code inside this function: api-events_catch_status() { echo "${blu}API Status: $1 ${end}" } diff --git a/lib/site-ssl b/lib/site-ssl index 7e79eae..886f45d 100644 --- a/lib/site-ssl +++ b/lib/site-ssl @@ -146,12 +146,12 @@ site_ssl_on() { cronmail=$( sudo grep -F "MAILTO=" /var/spool/cron/crontabs/root ) cronrene=$( sudo grep -F "certbot renew" /var/spool/cron/crontabs/root ) - [[ -z $cronmail && -n $cermail && -z $cronrene ]] && echo "MAILTO=${cermail}" | sudo tee -a /var/spool/cron/crontabs/root - [[ -z $cronrene ]] && echo '15 3 * * 7 certbot renew --post-hook "service nginx restart"' | sudo tee -a /var/spool/cron/crontabs/root + [[ -z $cronmail && -n $cermail && -z $cronrene ]] && echo "MAILTO=${cermail}" | sudo tee -a /var/spool/cron/crontabs/root > /dev/null + [[ -z $cronrene ]] && echo '15 3 * * 7 certbot renew --post-hook "service nginx restart"' | sudo tee -a /var/spool/cron/crontabs/root > /dev/null echo "${gre}SSL have been successfully enabled for your site -${blu} $domain${end}" elif [[ -a /etc/letsencrypt/live/$domain/fullchain.pem && $ssl == "force-renewal" ]]; then - echo "${gre}SSL Cert -${blu} $domain$ -${gre}has been Forced to Renew!${end}" + echo "${gre}SSL Cert ${blu}- $domain$ - ${gre}has been Forced to Renew!${end}" elif [[ ! -a /etc/letsencrypt/live/$domain/fullchain.pem ]]; then echo "${red}" echo "[ERROR] Unable to create the new certificate!" diff --git a/lib/sites b/lib/sites index beb0ae4..001d22d 100644 --- a/lib/sites +++ b/lib/sites @@ -480,7 +480,7 @@ deletesite() { [[ $revoke = [YyNn] ]] && break done fi - [[ $revoke =~ ^(on|y|Y)$ ]] && ssl_revoke + [[ $revoke =~ ^(on|y|Y)$ && -d /etc/letsencrypt/live/$domain ]] && ssl_revoke # Delete site files diff --git a/plugins/site b/plugins/site index 4344ebd..2d05813 100644 --- a/plugins/site +++ b/plugins/site @@ -145,20 +145,13 @@ elif [[ -n $delete_all ]]; then echo "All your sites files will be removed." echo "This action will only delete Databases attached to a WordPress site, any other Database will not be deleted." echo "${end}" - # List all sites in /var/www/ folder - for site in "/var/www"/* - do - delete="force" - domain=$(echo $site | cut -f 4 -d "/") - [[ $domain != "html" && $domain != $(conf_read tools-port) ]] && deletesite - done - + # List all remaining sites (parked and proxy) for site in "/etc/nginx/sites-available"/* do delete="force" - domi=$(echo $site | cut -f 5 -d "/") - [[ $domi != "html" && $domi != "default" && $domi != $(conf_read tools-port) ]] && deletesite + domain=$(echo $site | cut -f 5 -d "/") + [[ $domain != "html" && $domi != "default" && $domain != $(conf_read tools-port) ]] && deletesite done # Delete all files - double check!