Created
January 29, 2021 02:18
-
-
Save tyrm/130a254d9447d6385644de7e15c4a2a3 to your computer and use it in GitHub Desktop.
ptzo_backup_database.sh
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
#!/bin/bash | |
. /etc/default/backup | |
S3PATH=do/ptzo-backups/ptzo/db/$(date +%d) | |
TARGETFILE=ptzo.sql.gz | |
WORKDIR=/var/lib/backup | |
rm $WORKDIR/$TARGETFILE | |
rm $WORKDIR/$TARGETFILE.gpg | |
echo Dumping Database | |
pg_dump -h localhost -U mastodon -p 35432 mastodon_production | nice gzip > $WORKDIR/$TARGETFILE | |
echo Encrpyting File | |
gpg --yes --batch --passphrase=$GPG_PASSWORD -c $WORKDIR/$TARGETFILE | |
mc cp $WORKDIR/$TARGETFILE.gpg $S3PATH/$TARGETFILE.gpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment