diff --git a/BashScripts/install-apache/apache-add-site.sh b/BashScripts/install-apache/apache-add-site.sh index 77143bf..e4023ed 100644 --- a/BashScripts/install-apache/apache-add-site.sh +++ b/BashScripts/install-apache/apache-add-site.sh @@ -4,7 +4,7 @@ if [[ $EUID -ne 0 ]]; then exec sudo /bin/bash "$0" "$@" fi if [[ $1 = "" ]]; then - echo "Usage: add-site.sh [domain.com]" + echo "Usage: apache-add-site.sh [domain.com]" exit 0 fi domain=$(perl -e "(\$d)=\"$1\"=~/(\\w+\\.\\w+)\$/;print \$d") @@ -12,19 +12,17 @@ host=$(perl -e "(\$d)=\"$1\"=~/(\\w+)\\.\\w+\\.\\w+\$/;print \$d") red='\033[0;31m' green='\033[0;32m' nocolor='\033[0m' +if [[ -f "/etc/apache2/sites-enabled/$1.conf" ]]; then + echo "Config file $1.conf does already exist" + exit 1 +fi if [[ ! -d "/var/www/$1/www" ]]; then - # echo "Directory '/var/www/$1/www' does not exist" - # exit 1 mkdir "/var/www/$1" mkdir "/var/www/$1/www" fi if [[ ! -d "/var/www/$1/logs" ]]; then mkdir "/var/www/$1/logs" fi -if [[ -f "/etc/apache2/sites-enabled/$1.conf" ]]; then - echo "Config file $1.conf does already exist" - exit 1 -fi chmod -R 777 "/var/www/$1" echo "Searching for SSL certificate for $domain ..."