Skip to content

Instantly share code, notes, and snippets.

Forked from dommmel/
Last active November 25, 2018 18:08
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save strukturedkaos/09315ff2d70eaf294eae to your computer and use it in GitHub Desktop.
#! /bin/bash
# directory to save backups in, must be rwx by postgres user
YMD=$(date "+%Y-%m-%d")
mkdir -p $DIR
cd $DIR
# make database backup
dokku postgresql:dump sport | gzip -9 > "$DIR/db.out.gz"
# delete backup files older than 7 days
OLD=$(find $BASE_DIR -type d -mtime +7)
if [ -n "$OLD" ] ; then
echo deleting old backup files: $OLD
echo $OLD | xargs rm -rfv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment