added runit scripts

This commit is contained in:
tomit4 2022-02-23 12:16:48 -08:00
parent 2e437cd329
commit c65de416de
81 changed files with 114 additions and 0 deletions

25
runit_scripts/postgresql/run Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
[ -r conf ] && . ./conf
: ${PGDATA:="$PGROOT/data"}
if [ "$PGROOT" != "/var/lib/postgres" ]; then
echo "Creating symlink /var/lib/postgres -> $PGROOT"
ln -sf "$PGROOT" /var/lib/postgres
fi
if [ ! -d "$PGDATA" ]; then
echo "Initializing database in $PGDATA"
mkdir -p "$PGDATA"
chown -R postgres:postgres "$PGDATA"
chmod 777 "$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