Chris@1577: #!/bin/bash Chris@1577: Chris@1577: set -e Chris@1577: Chris@1589: # Start the database and if a dump file is found, load it. The dump Chris@1589: # file is then deleted so that the db won't be overwritten on Chris@1589: # subsequent runs. (The original repo contains no dump file, so it Chris@1589: # should exist only if you have provided some data to load.) Chris@1589: Chris@1577: /etc/init.d/postgresql start Chris@1577: Chris@1611: dumpdir="/code-to-deploy" Chris@1611: if [ ! -d "$dumpdir" ]; then Chris@1611: dumpdir=/var/www/code Chris@1611: fi Chris@1611: Chris@1611: cd "$dumpdir" Chris@1577: Chris@1577: if [ -f postgres-dumpall ]; then Chris@1577: chmod ugo+r postgres-dumpall Chris@1577: sudo -u postgres psql -f postgres-dumpall postgres Chris@1589: rm postgres-dumpall Chris@1577: fi Chris@1577: