Skip to content

Instantly share code, notes, and snippets.

@erikvw
Created November 1, 2018 16:16

Revisions

  1. erikvw created this gist Nov 1, 2018.
    23 changes: 23 additions & 0 deletions restore_db.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # restores archive file to the given folder.
    # then run mysql dbname < archive_file.sql

    . "$HOME/.duplicity/.env_variables.conf"

    # note will fail if file exists
    duplicity --verbosity info \
    --encrypt-sign-key=$GPG_KEY \
    --log-file $HOME/.duplicity/info.log \
    --file-to-restore $1 \
    $AWS_ENDPOINT/$AWS_BUCKET \
    $HOME/$1

    unset AWS_ACCESS_KEY_ID
    unset AWS_SECRET_ACCESS_KEY
    unset AWS_ENDPOINT
    unset AWS_BUCKET
    unset GPG_KEY
    unset PASSPHRASE
    unset DB_NAME
    unset DB_DATE
    unset DB_FILE
    unset BACKUP_DIR