From 60df28bb2e771b4cb921c889b019b25bdd1a939f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 7 Mar 2022 15:35:23 -0300 Subject: [PATCH] user --- postgresqld.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/postgresqld.sh b/postgresqld.sh index bc48997..5577f24 100755 --- a/postgresqld.sh +++ b/postgresqld.sh @@ -1,11 +1,13 @@ #!/bin/sh set -e +user=postgres + case $1 in stop) - su postgres -c "pg_ctl stop -D ${PGDATA}" ;; + su ${user} -c "pg_ctl stop -D ${PGDATA}" ;; reload) - su postgres -c "pg_ctl reload -D ${PGDATA}" ;; + su ${user} -c "pg_ctl reload -D ${PGDATA}" ;; *) pid=/run/postgresql.pid @@ -13,12 +15,12 @@ case $1 in chown -R ${user}:${user} ${PGBASE} 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 fi rm -f ${pid} - daemonize -u postgres -c ${PGDATA} /usr/bin/postgres + daemonize -u ${user} -c ${PGDATA} /usr/bin/postgres ;; esac