Created
September 27, 2012 17:58
-
-
Save paddya/3795408 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
UBERSPACE=paddya | |
DOMAIN=paddya.de | |
SUBDOMAIN=$1 | |
SQLDB="${UBERSPACE}_$1" | |
if [[ "$1" = "" ]] | |
then | |
echo "Oops, no subdirectory name specified." | |
exit 1 | |
else | |
if [[ ! -d "/var/www/virtual/$UBERSPACE/html/projects/$SUBDOMAIN" ]] | |
then | |
mysql -e "CREATE DATABASE \`$SQLDB\` CHARACTER SET utf8 COLLATE utf8_general_ci;" | |
mkdir "/var/www/virtual/$UBERSPACE/html/projects/$SUBDOMAIN" | |
ln -s "/var/www/virtual/$UBERSPACE/html/projects/$SUBDOMAIN" "/var/www/virtual/$UBERSPACE/$SUBDOMAIN.$DOMAIN" | |
echo "$SUBDOMAIN.$DOMAIN is now operational." | |
else | |
echo "$SUBDOMAIN.$DOMAIN already exists." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment