Created
July 9, 2013 11:58
-
-
Save benmay/5956803 to your computer and use it in GitHub Desktop.
Bash script used on dev server to create new WordPress sites.
This file contains 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/sh | |
# Set DB Constants | |
DBHOST="localhost" | |
DBUSER="root" | |
DBPASS="123" | |
DBNAME="wp_$1" | |
# Set WP Constants | |
ADMIN_NAME="my_admin_account" | |
ADMIN_PASS="admin_123" | |
ADMIN_EMAIL="[email protected]" | |
SITE_DOMAIN="http://my-dev-server/$1" | |
SITE_TITLE=$2 | |
# Create the DB if it doesnt exist (MySQL user would need create access) | |
mysql --verbose --user=$DBUSER -p$DBPASS --execute="create database IF NOT EXISTS $DBNAME" | |
# Create the directory | |
mkdir $1 | |
# Change Director, and do wp-cli stuff. | |
cd $1 && { | |
/root/.composer/bin/wp core download | |
/root/.composer/bin/wp core config --dbname=$DBNAME --dbuser=$DBUSER --dbpass=$DBPASS | |
/root/.composer/bin/wp core install \ | |
--url=$SITE_DOMAIN \ | |
--title=$SITE_TITLE \ | |
--admin_name=$ADMIN_NAME \ | |
--admin_email=$ADMIN_EMAIL \ | |
--admin_password=$ADMIN_PASS | |
/root/.composer/bin/wp plugin install wordpress-seo --activate | |
/root/.composer/bin/wp plugin install advanced-custom-fields --activate | |
} | |
# Dev permissions | |
chown -R www_intranet $1 | |
chmod -R 755 $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment