parent
a08a7292fd
commit
60df28bb2e
|
@ -1,11 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
user=postgres
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
stop)
|
stop)
|
||||||
su postgres -c "pg_ctl stop -D ${PGDATA}" ;;
|
su ${user} -c "pg_ctl stop -D ${PGDATA}" ;;
|
||||||
reload)
|
reload)
|
||||||
su postgres -c "pg_ctl reload -D ${PGDATA}" ;;
|
su ${user} -c "pg_ctl reload -D ${PGDATA}" ;;
|
||||||
*)
|
*)
|
||||||
pid=/run/postgresql.pid
|
pid=/run/postgresql.pid
|
||||||
|
|
||||||
|
@ -13,12 +15,12 @@ case $1 in
|
||||||
chown -R ${user}:${user} ${PGBASE}
|
chown -R ${user}:${user} ${PGBASE}
|
||||||
|
|
||||||
if test ! -f ${PGDATA}/PG_VERSION ; then
|
if test ! -f ${PGDATA}/PG_VERSION ; then
|
||||||
su postgres -c "/usr/bin/initdb -D ${PGDATA}"
|
su ${user} -c "/usr/bin/initdb -D ${PGDATA}"
|
||||||
|
|
||||||
echo "include_dir = '/etc/postgres.d'" >> ${PGDATA}/postgresql.conf
|
echo "include_dir = '/etc/postgres.d'" >> ${PGDATA}/postgresql.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${pid}
|
rm -f ${pid}
|
||||||
daemonize -u postgres -c ${PGDATA} /usr/bin/postgres
|
daemonize -u ${user} -c ${PGDATA} /usr/bin/postgres
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue