Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Backup OpenShift PostgreSQL Database
#!/bin/bash
# Backs up the OpenShift PostgreSQL database for this application
# by Skye Book <skye.book@gmail.com>
NOW="$(date +"%Y-%m-%d")"
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz"
pg_dump $OPENSHIFT_APP_NAME | gzip > $FILENAME

I liked this way of taking backup and not taking the backup of entire app.
Thank you very much for quick 3 lines, really helpful

shaiton commented Oct 23, 2014

Hi, I forked thinking we can do pull request but just found we can't actually.
I just added a line to clean old backup files (mtime +30 = 30 days old)

lucas03 commented Aug 4, 2015

does not work if database is on separate gear.

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