Created
August 24, 2010 18:38
-
-
Save deasmi/548065 to your computer and use it in GitHub Desktop.
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/bash | |
LIVEDB="live database name" | |
DEVDB="dev database name" | |
DEVURL="dev site url - perhaps locahost" | |
DBPASSWORD="db password" | |
LIVEPATH="live site path" | |
DEVPATH="dev site path" | |
echo "Dumping live database" | |
mysqldump --password=$DBPASSWORD --opt $LIVEDB > /tmp/live_dump.sql | |
echo "Loading to dev datbase" | |
mysql --password=$DBPASSWORD $DEVDB < /tmp/live_dump.sql | |
echo "Updating dev database" | |
cat << EOM | mysql --password=$DBPASSWORD $DEVDB | |
update wp_options set option_value="$DEVURL" where option_name='siteurl' | |
EOM | |
cat << EOM | mysql --password=$DBPASSWORD $DEVDB | |
update wp_options set option_value="$DEVURL" where option_name='home' | |
EOM | |
echo "Copying content" | |
/bin/cp -rp $LIVEPATH/* $DEVPATH/ | |
echo "Fixing wp-config.php" | |
cp $DEVPATH/wp-config.php /tmp/wp-config.php | |
cat /tmp/wp-config.php | sed "s/$LIVEDB/$DEVDB/g" | sed '/FORCE_SSL/d' > $DEVPATH/wp-config.php | |
cat << EOM >> $DEVPATH/wp-config.php | |
define('FORCE_SSL_LOGIN', false); | |
define('FORCE_SSL_ADMIN',false); | |
EOM | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment