Update 'setup.sh'

This commit is contained in:
verita84 2023-03-31 14:18:56 +00:00
parent 5ea7303b95
commit 7c1837c750

View File

@ -1,6 +1,17 @@
#!/bin/bash
export SHELL="/bin/bash"
postgres-check() {
POSTGRES_CHECK=$(ps aux | grep -i logical | head -1)
if [[ "$POSTGRES_CHECK" = *"replication"* ]]; then
echo "Postgres is running!"
else
echo "Postgres is not in Running yet!"
sleep 2
postgres-check
fi
}
database() {
mkdir /run/postgresql
mkdir -p $PG_DIR
@ -14,8 +25,7 @@ database() {
cp -f /etc/pg_hba.conf $PG_DIR
chown -R postgres:postgres $PG_DIR
su postgres -s $SHELL -lc "$PG_BIN/pg_ctl start -D $PG_DIR"&
#sleep 10
sleep 60
postgres-check
echo "SELECT pg_reload_conf();" | su postgres -s /bin/bash -lc "psql "
echo "create user root with encrypted password 'sql';"| su postgres -s $SHELL -lc psql
echo "ALTER ROLE root SUPERUSER;" | su postgres -s $SHELL -lc psql