Last active
December 9, 2021 16:16
-
-
Save ajithrn/ba097a8a4ecf7a29aa755481a0a0d194 to your computer and use it in GitHub Desktop.
Bulk Database Backup Trellis local Installtions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 " \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to import after recreate vagrant replace
wp db export
towp db import
(only if you run the command on the same day otherwise use a generic name for DB backup file)