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