Created
January 28, 2014 05:58
-
-
Save tmbritton/8662903 to your computer and use it in GitHub Desktop.
Sync Wordpress files and database
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 | |
# Sync prod down to local. | |
rsync -chavzP --stats [email protected]:/remote/path/to/root/wp-content/uploads/ /local/path/to/root/wp-content/uploads/ | |
echo "Creating MySQL dump" | |
mysqldump -P 3306 -h example.com -u username -pPASSWORD db_name > dump.sql | |
echo "Importing MySQL dump" | |
mysql -u root -proot -h 127.0.0.1 db_name < dump.sql | |
echo "Executing SQL commands" | |
mysql -u root -proot -e "UPDATE wp_options SET option_value = 'http://local.example.com' WHERE option_id = 1 OR option_id = 37" db_name | |
rm dump.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment