To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / deploy / provision.d / 080-database-load.sh @ 1606:16325d2ab2dd
History | View | Annotate | Download (477 Bytes)
| 1 | 1577:e38eee2e1d47 | Chris | #!/bin/bash |
|---|---|---|---|
| 2 | |||
| 3 | set -e |
||
| 4 | |||
| 5 | 1589:94669513c53c | Chris | # Start the database and if a dump file is found, load it. The dump |
| 6 | # file is then deleted so that the db won't be overwritten on |
||
| 7 | # subsequent runs. (The original repo contains no dump file, so it |
||
| 8 | # should exist only if you have provided some data to load.) |
||
| 9 | |||
| 10 | 1577:e38eee2e1d47 | Chris | /etc/init.d/postgresql start |
| 11 | |||
| 12 | cd /var/www/code |
||
| 13 | |||
| 14 | if [ -f postgres-dumpall ]; then |
||
| 15 | chmod ugo+r postgres-dumpall |
||
| 16 | sudo -u postgres psql -f postgres-dumpall postgres |
||
| 17 | 1589:94669513c53c | Chris | rm postgres-dumpall |
| 18 | 1577:e38eee2e1d47 | Chris | fi |