-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathno-wp-cli.sh
More file actions
18 lines (15 loc) · 716 Bytes
/
no-wp-cli.sh
File metadata and controls
18 lines (15 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash
# Purpose: WordPress staging for Apache
# Source: https://guides.wp-bullet.com
# Adapted
# Author: Mike
# define WordPress path and wp-config.php file
WPPATH="/var/www/domain.com"
WPCONFIG="$WPPATH/wp-config.php"
# extract database host and credentials
DBHOST=$(grep DB_HOST "$WPCONFIG" | awk -F ["'"] '{ print $4 }')
DBUSER=$(grep DB_USER "$WPCONFIG" | awk -F ["'"] '{ print $4 }')
DBPASS=$(grep DB_PASSWORD "$WPCONFIG" | awk -F ["'"] '{ print $4 }')
DBNAME=$(grep DB_NAME "$WPCONFIG" | awk -F ["'"] '{ print $4 }')
# mysqldump optimized for speed and gzip
mysqldump -h "$DBHOST" -u "$DBUSER" -p"$DBPASS" "$DBNAME" --single-transaction --quick --lock-tables=false | gzip > /tmp/latest.sql.gz