-
-
Save kelby/eb31abcb25594bcc285d to your computer and use it in GitHub Desktop.
Backup OpenShift PostgreSQL Database
This file contains 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 | |
# Backs up the OpenShift PostgreSQL database for this application | |
# by Skye Book <[email protected]> | |
# Local | |
rhc ssh | |
# Seiver | |
NOW="$(date +"%Y-%m-%d")" | |
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz" | |
pg_dump $OPENSHIFT_APP_NAME | gzip > $FILENAME | |
# Local | |
echo $FILENAME | |
rhc scp rails4app download /tmp $FILENAME | |
gunzip # $OPENSHIFT_APP_NAME.$NOW.backup.sql.gz | |
psql databasename < data_base_dump | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment