Skip to content

Instantly share code, notes, and snippets.

@ajithrn
Last active December 9, 2021 16:16
Show Gist options
  • Save ajithrn/ba097a8a4ecf7a29aa755481a0a0d194 to your computer and use it in GitHub Desktop.
Save ajithrn/ba097a8a4ecf7a29aa755481a0a0d194 to your computer and use it in GitHub Desktop.
Bulk Database Backup Trellis local Installtions
# Trellis Database Backup script for all bedrock folders.
# Use case backup all db before destroy vagrant and create.
# need to run from trellis folder on terminal
vagrant ssh
cd /srv/www
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}'/current && mkdir -p db_backup && wp db export db_backup/database_`date +%Y%m%d`.sql " \;
@ajithrn
Copy link
Author

ajithrn commented Dec 9, 2021

to import after recreate vagrant replace wp db export to wp db import (only if you run the command on the same day otherwise use a generic name for DB backup file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment