From 06f317fb37c0730a2894e461bd6427ce736fc1bc Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 27 Jan 2019 17:34:22 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 104 +++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index acf1620f..12a80fca 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -66,118 +66,124 @@ MAIN_MENU() { case "$1" in - start) + haproxy-start) sleep 15 - echo -e "${BBlue}HAProxy Starting...${Color_Off}" - service haproxy start + echo -e "${idsCL[LightBlue]}HAProxy Starting...${idsCL[Default]}" + ssh root@10.5.10.51 service haproxy start ssh root@10.5.10.52 service haproxy start ssh root@10.5.10.53 service haproxy start - echo -e "${BBlue}NGINX Reload...${Color_Off}" - service nginx reload - ssh root@10.5.10.52 service nginx reload - ssh root@10.5.10.53 service nginx reload + exit 0;; - exit 0 - ;; - - stop) - echo -e "${BBlue}HAProxy Stopping...${Color_Off}" - service haproxy stop + haproxy-stop) + echo -e "${idsCL[LightBlue]}HAProxy Stopping...${idsCL[Default]}" + ssh root@10.5.10.51 service haproxy stop ssh root@10.5.10.52 service haproxy stop ssh root@10.5.10.53 service haproxy stop exit 0;; + + haproxy-restart) + sleep 15 + echo -e "${idsCL[LightBlue]}HAProxy Starting...${idsCL[Default]}" + ssh root@10.5.10.51 service haproxy restart + ssh root@10.5.10.52 service haproxy restart + ssh root@10.5.10.53 service haproxy restart + exit 0;; gogs-start) - echo -e "${BBlue}Gogs Starting...${Color_Off}" - service gogs start + echo -e "${idsCL[LightBlue]}Gogs Starting...${idsCL[Default]}" + ssh root@10.5.10.51 service gogs start ssh root@10.5.10.52 service gogs start ssh root@10.5.10.53 service gogs start exit 0;; gogs-stop) - echo -e "${BBlue}Gogs Stopping...${Color_Off}" - service gogs stop + echo -e "${idsCL[LightBlue]}Gogs Stopping...${idsCL[Default]}" + ssh root@10.5.10.51 service gogs stop ssh root@10.5.10.52 service gogs stop ssh root@10.5.10.53 service gogs stop exit 0;; gogs-restart) - echo -e "${BBlue}Gogs Restarting...${Color_Off}" - service gogs restart + echo -e "${idsCL[LightBlue]}Gogs Restarting...${idsCL[Default]}" + ssh root@10.5.10.51 service gogs restart ssh root@10.5.10.52 service gogs restart ssh root@10.5.10.53 service gogs restart exit 0;; nginx-start) - echo -e "${BBlue}NGINX Starting...${Color_Off}" - service nginx start + echo -e "${idsCL[LightBlue]}NGINX Starting...${idsCL[Default]}" + ssh root@10.5.10.51 service nginx start ssh root@10.5.10.52 service nginx start ssh root@10.5.10.53 service nginx start exit 0;; nginx-stop) - echo -e "${BBlue}NGINX Stopping...${Color_Off}" - service nginx stop + echo -e "${idsCL[LightBlue]}NGINX Stopping...${idsCL[Default]}" + ssh root@10.5.10.51 service nginx stop ssh root@10.5.10.52 service nginx stop ssh root@10.5.10.53 service nginx stop exit 0;; nginx-restart) - echo -e "${BBlue}NGINX Restarting...${Color_Off}" - service nginx restart + echo -e "${idsCL[LightBlue]}NGINX Restarting...${idsCL[Default]}" + ssh root@10.5.10.51 service nginx restart ssh root@10.5.10.52 service nginx restart ssh root@10.5.10.53 service nginx restart exit 0;; - reload) - service nginx reload +nginx-reload) + echo -e "${idsCL[LightBlue]}NGINX Reloading...${idsCL[Default]}" + ssh root@10.5.10.51 service nginx reload ssh root@10.5.10.52 service nginx reload ssh root@10.5.10.53 service nginx reload exit 0 ;; - new) - # "$0" stop - echo -e "${Green}Requesting Certificate for '${BBlue}$2${Green}'...${Color_Off}" + newcert) + "$0" haperoxy-stop + echo -e "${Green}Requesting Certificate for '${BBlue}$2${Green}'...${idsCL[Default]}" # $DAEMON certonly --standalone -d $2 $DAEMON certonly --webroot -w /var/www/html -d $2 # chown -R root:letsencrypt /etc/letsencrypt # chmod -R 6775 /etc/letsencrypt - # "$0" start - # redirect_artica-ssl_files + "$0" haproxy-start + echo -e "${Green}Waiting for Certificate Replication...${idsCL[Default]}" + sleep 20 + "$0" nginx-reload exit 0 ;; - new-mass) - echo -e "${Green}Requesting Certificate for '${BBlue}$2${Green}'...${Color_Off}" + newmass) + echo -e "${Green}Requesting Certificate for '${BBlue}$2${Green}'...${idsCL[Default]}" # $DAEMON certonly --standalone -d $2 $DAEMON certonly --webroot -w /var/www/html -d $2 # chown -R root:letsencrypt /etc/letsencrypt # chmod -R 6775 /etc/letsencrypt - # redirect_artica-ssl_files exit 0 ;; - renew) - "$0" stop - echo -e "${Green}Renewing Certificates...${Color_Off}" + certrenew) + "$0" haperoxy-stop + echo -e "${Green}Renewing Certificates...${idsCL[Default]}" # $DAEMON renew $DAEMON renew certonly --webroot -w /var/www/html -d $2 - chown -R root:letsencrypt /etc/letsencrypt - chmod -R 6775 /etc/letsencrypt - "$0" start - # redirect_artica-ssl_files + #chown -R root:letsencrypt /etc/letsencrypt + #chmod -R 6775 /etc/letsencrypt + "$0" haperoxy-start + echo -e "${Green}Waiting for Certificate Replication...${idsCL[Default]}" + sleep 20 + "$0" nginx-reload exit 0 ;; nightlyrenew) - rm -f /opt/nodemgmt/cert-renewal-run-$(hostname) - "$0" stop >> /opt/nodemgmt/cert-renewal-run-$(hostname) - # $DAEMON renew >> /opt/nodemgmt/cert-renewal-run-$(hostname) - $DAEMON renew certonly --webroot -w /var/www/html -d $2 >> /opt/nodemgmt/cert-renewal-run-$(hostname) - chown -R root:letsencrypt /etc/letsencrypt - chmod -R 6775 /etc/letsencrypt - "$0" start >> /opt/nodemgmt/cert-renewal-run-$(hostname) + rm -f /opt/idssys/nodemgmt/cert-renewal-run-$(hostname) + "$0" stop >> /opt/idssys/nodemgmt/cert-renewal-run-$(hostname) + # $DAEMON renew >> /opt/idssys/nodemgmt/cert-renewal-run-$(hostname) + $DAEMON renew certonly --webroot -w /var/www/html -d $2 >> /opt/idssys/nodemgmt/cert-renewal-run-$(hostname) + #chown -R root:letsencrypt /etc/letsencrypt + #chmod -R 6775 /etc/letsencrypt + "$0" start >> /opt/idssys/nodemgmt/cert-renewal-run-$(hostname) exit 0 ;;