diff --git a/runit_scripts/postgresql/run b/runit_scripts/postgresql/run index b9809968..ca1d5273 100755 --- a/runit_scripts/postgresql/run +++ b/runit_scripts/postgresql/run @@ -8,13 +8,19 @@ if [ "$PGROOT" != "/var/lib/postgres" ]; then ln -sf "$PGROOT" /var/lib/postgres fi +if [ ! -d "/var/run/postgresql" ]; then + echo "creating directory /var/run/postgresql" + + mkdir -p "/var/run/postgresql" + chown -R postgres:postgres "/var/run/postgresql" +fi if [ ! -d "$PGDATA" ]; then echo "Initializing database in $PGDATA" - mkdir -p "$PGDATA" + mkdir -p "$PGDATA" chown -R postgres:postgres "$PGDATA" - chmod 777 "$PGDATA" + chmod 0700 "$PGDATA" su - postgres -m -c "/usr/bin/initdb $INITOPTS -D '$PGDATA'" >/dev/null if [ -f /etc/postgresql/postgresql.conf ]; then