-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush-pull-wp.sh
More file actions
30 lines (24 loc) · 840 Bytes
/
push-pull-wp.sh
File metadata and controls
30 lines (24 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin.bash
#
#This script moves databases and content folders from one destination to another
#
#Execute using the following command
# bash push-pull-wp.sh
#
read -p 'Which site would you like to start with as your base: ' basevar
mkdir tmpdb
cd /var/www/html/${basevar}
wp db export /var/www/html/tmpdb/${basevar}.sql --add-drop-table --allow-root
read -p 'Which site would you like to push your site to: ' pushvar
cd /var/www/html/${pushvar}
wp db import /var/www/html/tmpdb/${basevar}.sql --allow-root
baseurl= #place the name of your server here
basetarget="${baseurl}${basevar}/"
pushtarget="${baseurl}${pushvar}/"
wp search-replace --url "${basetarget}" "${pushtarget}" --allow-root
##Moving the content files
cd /var/www/html/
pwd
rm -rf ${pushvar}/wp-content
cp -r ${basevar}/wp-content ${pushvar}/wp-content
rm -rf tmpdb