Skip to content

Instantly share code, notes, and snippets.

@mrtazz
Created December 3, 2010 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrtazz/726788 to your computer and use it in GitHub Desktop.
Save mrtazz/726788 to your computer and use it in GitHub Desktop.
dump the redmine DB from psql and commit it to a git repository
#!/bin/sh
#
# shell script to dump a database from PostgreSQL and
# store it in git
#
AUTHOR="User <user@host>"
GITCMD="/usr/local/bin/git"
DUMPCMD="/usr/local/bin/pg_dump"
BACKUP_REPO="/path/to/repo"
DUMPFILE="redmine.sql"
DB="NAME_OF_YOUR_REDMINE_DB"
# dump, commit and push
${DUMPCMD} ${DB} > ${BACKUP_REPO}${DUMPFILE}
cd ${BACKUP_REPO}
${GITCMD} add ${DUMPFILE}
${GITCMD} commit -q --author "${AUTHOR}" -m "update redmine dump"
${GITCMD} push -q origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment