Staging_Environment/syncfromlivetostaging.sh

5 lines
418 B
Bash

#!/bin/bash
liveURL="`cat /var/www/webroot/sourcefiles/livedomain`"
stagingURL="`wp option get siteurl | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/'`"
cd /var/www/webroot/ROOT/ && wp db import /var/www/webroot/sourcefiles/dbexport.sql --path=/var/www/webroot/ROOT/ && cp -R -u /var/www/webroot/sourcefiles/* /var/www/webroot/ROOT && wp cache flush && wp search-replace $liveURL $stagingURL --all-tables --precise