WordPress websites migreren via SSH, rsync, mysqldump, mysql

Het migreren van WordPress websites kan vaak erg snel gerealiseerd worden met behulp van SSH en enkele commando’s. Hieronder een aantal commando’s die hierbij van pas komen:

rsync --archive --verbose --compress --exclude-from=/data/www/example.com/public_html/.gitignore user@123.456.789.0:/home/user/domains/example.com/private_html/ /data/www/example.com/public_html/.
rsync --archive --verbose --compress --rsh='ssh -p 18765' /Users/remco/Downloads/example.com/ user@123.456.789.0:/home/user/public_html/.
mysqldump --host=123.456.789.0 --user=user_wp --password=******** --databases db_wp > /data/www/example.com/databases/db_wp.sql
mysql --host=123.456.789.0 --user=user_wp --password=******** mysql --execute="DROP DATABASE db_wp; CREATE DATABASE db_wp;"

mysql --host=123.456.789.0 --user=user_wp --password=******** db_wp < /data/www/example.com/databases/db_wp.sql
find /data/www/example.com/public_html/wp-content/uploads -type d -exec chmod 775 {} \;
find . -type d -exec chmod 755 {} +
curl http://*.s3.amazonaws.com/site.zip --output site.zip

unzip site.zip -d site