From ee1951a3fb394f5c618b22b2de21345e935218ff Mon Sep 17 00:00:00 2001 From: bprieshof Date: Wed, 11 Dec 2019 12:08:46 +0100 Subject: [PATCH] Fixed multiple oopsies --- Scripts/EnableSSL.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Scripts/EnableSSL.sh b/Scripts/EnableSSL.sh index 8286ff3..4c89cbe 100644 --- a/Scripts/EnableSSL.sh +++ b/Scripts/EnableSSL.sh @@ -4,13 +4,15 @@ domainwww=DomainWWW email=Email webserver=WebServer webservice=WebServer + +#correcting service name for apache if [ $webservice = apache ]; then webservice=apache2 fi #Backing-up and removing current config -sed -n '/#beginConf/,/#endConf/p' /etc/"$webservice"/sites-enabled/"domain" > /tmp/"$domain"-config -sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere1\n/};p' /etc/"$webservice"/sites-enabled/"domain" +sed -n '/#beginConf/,/#endConf/p' /etc/"$webservice"/sites-enabled/"$domain" > /tmp/"$domain"-config +sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere1\n/};p' /etc/"$webservice"/sites-enabled/"$domain" systemctl restart $webservice #Enabling SSL @@ -21,6 +23,6 @@ elif [ $domainwww = 0 ]; then fi #Restoring config -sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/"$domain"-config' -e '/#ConfHere/c\' /etc/"$webservice"/sites-enabled/"domain" +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e "/#ConfHere1/ r /tmp/"$domain"-config" -e '/#ConfHere/c\' /etc/"$webservice"/sites-enabled/"$domain" systemctl restart $webservice \ No newline at end of file