Creazione automatica sito web apache con bash

Ecco un semplice script che crea website, alias, directory automaticamente tramite bash 

#!/bin/bash

echo "Inserisci dominio (es: example.com):";
read domain;
echo ""
echo "Inserisci Alias (es: www.example.com):";
read domain_alias;
echo ""

### Check $domain esiste
if ! grep "${domain}" /etc/apache2/sites-available/${domain}.conf >> /dev/null; then
echo "${domain} will be created"
mkdir -p /var/www/${domain}/{htdocs,logs,cgi-bin};
chown -R www-data:www-data /var/www/${domain}/

echo "
## Automatic generation from Genesi on `eval date +%d.%m.%Y`
## ${domain}

ServerName ${domain}
ServerAlias ${domain_alias}
DocumentRoot /var/www/${domain}/htdocs
ServerAdmin tech@neen.it

ErrorLog /var/www/${domain}/logs/error.log
CustomLog /var/www/${domain}/logs/access.log combined


Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

" >> /etc/apache2/sites-available/${domain}.conf

echo "Testing configuration"
apache2ctl configtest
a2ensite ${domain}.conf
/etc/init.d/apache2 reload
else
echo "${domain} Dominio già esistente"
fi