Created
May 16, 2017 13:05
-
-
Save ajslaghu/d641cbf220802edb1ea012ad9f4d58cb to your computer and use it in GitHub Desktop.
Snippet for updating links in wordpress on docker setup
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 | |
echo param is $1 | |
# DUMPING A TABLE | |
MYSQL=c-mysql | |
CLI=i-mysql-cli | |
HOSTPATH=/srv/wp-mu/data/mysql | |
DOCKERPATH=/mnt/data | |
ADMIN_PASSWORD=$( docker logs $MYSQL 2>&1 | grep " mysql -uadmin" | awk '{print $3}' | cut -c 3- ) | |
IP=$(docker inspect $MYSQL | grep IPAddress | cut -d '"' -f 4) | |
echo $IP | |
echo $ADMIN_PASSWORD | |
SCHEMA=wp-mu | |
TABLE=wp_10_posts | |
#exit | |
docker run -rm -t -i -v $HOSTPATH:$DOCKERPATH:r $CLI /usr/bin/mysqldump -h $IP -u admin --password=$ADMIN_PASSWORD $SCHEMA $TABLE > table.sql | |
#cat table.sql | sed 's:hackdeoverheid.nl/wp-content/uploads/: LEXIO :g' > lexio.sql | |
cat table.sql | sed 's:hackdeoverheid.nl/wp-content/uploads/:hackdeoverheid.nl/wp-content/uploads/sites/10/:g' > newtable.sql | |
docker run -rm -t -i -v $HOSTPATH:$DOCKERPATH:r $CLI /usr/bin/mysql -h $IP -u admin --password=$ADMIN_PASSWORD $SCHEMA < newtable.sql | |
[3:04] | |
dit is de code om http links te veranderen in mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment