-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_to_host.sh
46 lines (35 loc) · 1.03 KB
/
deploy_to_host.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#===============================================================================
# settings
REPO=~/GIT-REPO
WP_SRC=$REPO/wp
WP_DST=~/www
#===============================================================================
# get latest version from git
cd $REPO
git pull
#===============================================================================
# copy files as needed
for d in \
wp-content/uploads
do
dd=$(dirname $WP_DST/$d)
echo "copying $dd"
mkdir -p $dd
cp -r $WP_SRC/$d $dd
done
#===============================================================================
# update core, plugins & themes
cd $WP_DST
wp core update
wp plugin update --all
wp theme update --all
#===============================================================================
# backup & replace database
mkdir $REPO/backup
cd $WP_DST
wp db export $REPO/backup/backup-`date +%F_%H-%M-%S`.sql
wp db reset --yes
wp db import $REPO/sql/db.sql
#===============================================================================
# end of file