- commit
- 6992a76a9b8200a270bd62eae8c0d2ca69ec0670
- parent
- aafb60479a78b2889cbe45a4431d1e099f46e02b
- Author
- Tobias Bengfort <tobias.bengfort@liqd.de>
- Date
- 2016-09-15 13:57
refactor manage_db.sh
Diffstat
| R | bin/initialize_db.sh -> bin/manage_db.sh | 28 | +++++++++++++++++++++++++--- |
1 files changed, 25 insertions, 3 deletions
diff --git a/bin/initialize_db.sh b/bin/manage_db.sh
@@ -3,9 +3,31 @@ 3 3 cd "$(dirname "$0")/.." 4 4 DB_DIR="$(pwd)/data/postgres" 5 5 mkdir -p $DB_DIR6 -1 if test ! -d "$DB_DIR/base"; then7 -1 pg_ctl initdb -D "$DB_DIR"-1 6 -1 7 start() { 8 8 pg_ctl start -w -D "$DB_DIR" -o "-h localhost" -o "-k '$DB_DIR'"9 -1 createdb -h "$DB_DIR" voterunner-1 9 } -1 10 -1 11 stop() { 10 12 pg_ctl stop -D "$DB_DIR" -1 13 } -1 14 -1 15 if [ "$1" = 'start' ]; then -1 16 start -1 17 elif [ "$1" = 'stop' ]; then -1 18 stop -1 19 elif [ "$1" = 'init' ]; then -1 20 if test ! -d "$DB_DIR/base"; then -1 21 pg_ctl initdb -D "$DB_DIR" -1 22 start -1 23 createdb -h "$DB_DIR" voterunner -1 24 stop -1 25 else -1 26 echo "skipping" -1 27 fi -1 28 elif [ "$1" = 'clean' ]; then -1 29 rm -r "$DB_DIR" -1 30 else -1 31 echo "invalid command" -1 32 exit 1 11 33 fi