Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: jvinet/packrat
base: 41d538150f
...
head fork: jvinet/packrat
compare: 86460f9c06
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 19, 2012
Stephen Sugden grncdr Add postgresql module d954b4e
Commits on Apr 23, 2012
Judd Vinet Merge pull request #1 from grncdr/master
add the postgresql module
86460f9
Showing with 30 additions and 0 deletions.
  1. +30 −0 modules/postgresql.sh
30 modules/postgresql.sh
View
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+mod_postgresql() {
+ verbose "[POSTGRESQL] running..."
+ for db in "${POSTGRESQL_TARGETS[@]}"; do
+ opts=""
+ [ "$POSTGRESQL_USER" != "" ] && opts="$opts -U ${POSTGRESQL_USER}"
+ [ "$POSTGRESQL_HOST" != "" ] && opts="$opts -h ${POSTGRESQL_HOST}"
+ [ "$POSTGRESQL_PORT" != "" ] && opts="$opts -p ${POSTGRESQL_PORT}"
+ if [ "$db" = "__ALL__" ]; then
+ opts="$opts -A"
+ dbname="all"
+ else
+ opts="$opts $db"
+ dbname=$db
+ fi
+ fn="${BACKUP_DIR}/$HOSTNAME-postgresql-${dbname}-$TODAY.sql.bz2"
+ verbose "[POSTGRESQL] backup up database: $db"
+ if [ "$POSTGRESQL_ENCRYPTION_KEY" ]; then
+ # decrypt with 'openssl enc -d -bf -pass pass:<password> -in infile -out outfile'
+ verbose "[POSTGRESQL] cmd: pg_dump $opts | bzip2 | openssl enc -e -salt -bf -pass pass:$POSTGRESQL_ENCRYPTION_KEY >$fn"
+ pg_dump $opts | bzip2 | openssl enc -e -salt -bf -pass pass:$POSTGRESQL_ENCRYPTION_KEY >$fn
+ else
+ verbose "[POSTGRESQL] cmd: pg_dump $opts | bzip2 >$fn"
+ pg_dump $opts | bzip2 >$fn
+ fi
+ [ $? -eq 0 ] || die "ERROR: command did not complete successfully"
+ NEW_BACKUPS="$NEW_BACKUPS $fn"
+ done
+}

No commit comments for this range

Something went wrong with that request. Please try again.