Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created August 16, 2014 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/a70723378a847271db36 to your computer and use it in GitHub Desktop.
Save westonruter/a70723378a847271db36 to your computer and use it in GitHub Desktop.
Script to help transfer databases from Varying Vagrant Vagrants (VVV) 1.1 to 1.2
#!/bin/bash
cd /srv/www
mkdir vvv-upgrade-backups
find /etc/nginx/custom-sites/ -name '*.conf' | xargs grep -h 'root' | grep '/' | sed 's:\s*root\s\s*::' | sed 's:;$::' > roots.txt
for root in $(cat roots.txt); do
echo $root;
cd $root;
filename=$( echo $root | sed 's:/srv/www/::' | sed 's:/:-:g' ).sql;
wp db export /srv/www/vvv-upgrade-backups/$filename;
done;
cd /srv/www
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment