try-vue: add pgsql runner
This commit is contained in:
parent
10d560623d
commit
6e97bf67d6
24
deploy/run_psql.sh
Normal file
24
deploy/run_psql.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# to run this execute
|
||||
# export PSQL_HOME_DIR=/home/user/pgsql-10.5.1; bash ./deploy/run_psql.sh
|
||||
PSQL_DATA_DIR=./ng-tracker
|
||||
PSQL_USER_NAME=postgres
|
||||
PSQL_DB_NAME=ng-tracker
|
||||
if [ ! -d "$PSQL_HOME_DIR" ]; then
|
||||
echo "Directory $PSQL_HOME_DIR is not exists"
|
||||
exit 0
|
||||
fi
|
||||
cd "$PSQL_HOME_DIR"
|
||||
if [ ! -d "$PSQL_DATA_DIR" ]; then
|
||||
./bin/initdb "$PSQL_DATA_DIR"
|
||||
./bin/pg_ctl -D "$PSQL_DATA_DIR" start
|
||||
./bin/createuser -s "$PSQL_USER_NAME"
|
||||
./bin/createdb -O "$PSQL_USER_NAME" "$PSQL_DB_NAME"
|
||||
else
|
||||
PSQL_STATUS=$(./bin/pg_ctl -D "$PSQL_DATA_DIR" status | wc -l)
|
||||
if [ $PSQL_STATUS -eq 1 ]; then
|
||||
./bin/pg_ctl -D "$PSQL_DATA_DIR" start
|
||||
else
|
||||
./bin/pg_ctl -D "$PSQL_DATA_DIR" stop
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user