2019-10-26 14:33:46 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -xeuo pipefail
|
|
|
|
|
|
|
|
if [[ $1 == init ]]; then
|
|
|
|
mkdir -p db && initdb db
|
|
|
|
pg_ctl -D db -l db/logfile start
|
|
|
|
|
2019-10-26 15:12:18 +03:00
|
|
|
psql -c 'CREATE EXTENSION postgis;'
|
|
|
|
psql < init.sql
|
2019-10-26 14:33:46 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $1 == start ]]; then
|
|
|
|
pg_ctl -D db -l db/logfile start
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $1 == stop ]]; then
|
|
|
|
pg_ctl -D db -l db/logfile stop
|
|
|
|
fi
|