Skip to content

Instantly share code, notes, and snippets.

@skyebook
Last active April 16, 2016 13:20
  • Star 15 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save skyebook/3407646 to your computer and use it in GitHub Desktop.
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
@harit-sunrun
Copy link

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
Copy link

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
Copy link

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