25 lines
546 B
Bash
25 lines
546 B
Bash
|
#!/bin/sh
|
||
|
set -e
|
||
|
|
||
|
case $1 in
|
||
|
stop)
|
||
|
su postgres -c "pg_ctl stop -D ${PGDATA}" ;;
|
||
|
reload)
|
||
|
su postgres -c "pg_ctl reload -D ${PGDATA}" ;;
|
||
|
*)
|
||
|
pid=/run/postgresql.pid
|
||
|
|
||
|
install -dm 2750 -o ${user} -g ${user} /run/postgresql
|
||
|
chown -R ${user}:${user} ${PGBASE}
|
||
|
|
||
|
if test ! -f ${PGDATA}/PG_VERSION ; then
|
||
|
su postgres -c "/usr/bin/initdb -D ${PGDATA}"
|
||
|
|
||
|
echo "include_dir = '/etc/postgres.d'" >> ${PGDATA}/postgresql.conf
|
||
|
fi
|
||
|
|
||
|
rm -f ${pid}
|
||
|
daemonize -u postgres -c ${PGDATA} /usr/bin/postgres
|
||
|
;;
|
||
|
esac
|