photos-api/start-db.sh
2022-05-21 19:00:06 +02:00

24 lines
300 B
Bash
Executable File

#!/bin/sh
if [ -f data/db/postmaster.pid ]
then
echo "already started"
exit
fi
INIT=0
if [ ! -d data/db ]
then
mkdir -p data
initdb --locale=C -E UTF-8 data/db
INIT=1
fi
pg_ctl -D data/db -l data/db.log start
if [ "$INIT" == "1" ]
then
sleep 2
createdb photos
createuser photos
fi