Last active
August 29, 2015 14:16
-
-
Save codex73/bb6be9a56f671c79be8d 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 | |
| if [ $1 == '' ]; then | |
| v_valid=false; | |
| #obtain the desired site name | |
| while ! $v_valid; do | |
| read -p "site name:" site_name | |
| if [ "$site_name" != '' ]; then | |
| $v_valid = true; | |
| break; | |
| else | |
| echo "please enter a site name"; | |
| fi | |
| done; | |
| else | |
| site_name=$1 | |
| fi | |
| echo "creating directory www/$site_name/"; | |
| mkdir www/$site_name; | |
| echo "creating site content folder www/$site_name/htdocs/" | |
| mkdir www/$site_name/htdocs; | |
| echo "adding site url to vvv-host file" | |
| cat > www/$site_name/vvv-hosts << EOF | |
| localhost.$site_name | |
| EOF | |
| echo "adding site url to config/nginx-config/sites/$site_name.conf" | |
| cat > config/nginx-config/sites/$site_name.conf << EOF | |
| server { | |
| listen 80; | |
| listen 443 ssl; | |
| server_name localhost.$site_name; | |
| root /srv/www/$site_name/htdocs; | |
| include /etc/nginx/nginx-wp-common.conf; | |
| } | |
| EOF | |
| read -p "provision vagrant? y or enter to skip:" v_bool_provision | |
| case $v_bool_provision in | |
| [Yy]* ) vagrant provision; vagrant up; | |
| esac | |
| echo "new site: http://localhost.$site_name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment