Scripting a Wordpress rollout - Method II
Now even shinier!
It's a rude and crude script, but it works for experienced admins who knows what they are doing,
and where they are doing it.
Usage:
etc....
Takes all of 3 seconds to roll out.
Enjoy the goodness.
It's a rude and crude script, but it works for experienced admins who knows what they are doing,
and where they are doing it.
Code:
#!/bin/bash ### 11/30/2015 ### jj/Habitual clear do_work () { BASEDIR=/var/www/html mkdir -pv "$BASEDIR"/"$DOMAIN"/ cp -pr /var/www/wordpress/* "$BASEDIR"/"$DOMAIN"/ cp "$BASEDIR"/"$DOMAIN"/wp-config-sample.php "$BASEDIR"/"$DOMAIN"/wp-config.php ### MySQL Database Routine ### ### MySQL hates .tld in db names, so change .tld to _tld MYSQLDOMAIN=$(echo $DOMAIN | sed 's/\./_/g') mysql -e "create database IF NOT EXISTS $MYSQLDOMAIN;" CONNECT_PASSWORD=$(date +%s | sha256sum | base64 | head -c 12 ; echo) mysql -e "grant select, insert, update, delete on $MYSQLDOMAIN.* to wp_installer@'localhost' identified by '$CONNECT_PASSWORD';flush privileges;" sed -i -e 's@database_name_here@'"$MYSQLDOMAIN"'@' $BASEDIR/$DOMAIN/wp-config.php sed -i -e 's@username_here@wp_installer@' $BASEDIR/$DOMAIN/wp-config.php sed -i -e 's@password_here@'"$CONNECT_PASSWORD"'@' $BASEDIR/$DOMAIN/wp-config.php chown apache:apache "$BASEDIR"/"$DOMAIN"/ -R } for DOMAIN in "$@" do do_work done
Code:
<script.sh> example1.net example2.net example3.net ... ...
Takes all of 3 seconds to roll out.
Enjoy the goodness.
Total Comments 0