initial import
This commit is contained in:
30
postgresql/postgresql.run
Normal file
30
postgresql/postgresql.run
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
[ -r conf ] && . ./conf
|
||||
: ${PGDATA:="$PGROOT/data"}
|
||||
|
||||
if [ "$PGROOT" != "/var/lib/postgresql" ]; then
|
||||
echo "Creating symlink /var/lib/postgresql -> $PGROOT"
|
||||
|
||||
# Remove /var/lib/postgres if empty dir, but not if symlink
|
||||
if [ ! -L /var/lib/postgres ] && [ -d /var/lib/postgres ]; then
|
||||
rmdir /var/lib/postgres
|
||||
fi
|
||||
|
||||
ln -sf "$PGROOT" /var/lib/postgresql
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d "$PGDATA" ]; then
|
||||
echo "Initializing database in $PGDATA"
|
||||
|
||||
mkdir -p "$PGDATA"
|
||||
chown -R postgres:postgres "$PGDATA"
|
||||
chmod 0700 "$PGDATA"
|
||||
su - postgres -m -c "/usr/bin/initdb $INITOPTS -D '$PGDATA'" >/dev/null
|
||||
|
||||
if [ -f /etc/postgresql/postgresql.conf ]; then
|
||||
ln -sf /etc/postgresql/postgresql.conf "$PGDATA/postgresql.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
exec chpst -u postgres:postgres postgres -D "$PGDATA" $PGOPTS 2>&1
|
||||
Reference in New Issue
Block a user