summaryrefslogtreecommitdiff
path: root/testing/postgresql/postgresql.service
diff options
context:
space:
mode:
Diffstat (limited to 'testing/postgresql/postgresql.service')
-rw-r--r--testing/postgresql/postgresql.service19
1 files changed, 13 insertions, 6 deletions
diff --git a/testing/postgresql/postgresql.service b/testing/postgresql/postgresql.service
index 2fcd3e93d..bea14e01e 100644
--- a/testing/postgresql/postgresql.service
+++ b/testing/postgresql/postgresql.service
@@ -1,19 +1,26 @@
[Unit]
Description=PostgreSQL database server
+After=network.target
[Service]
Type=forking
+TimeoutSec=120
+User=postgres
+Group=postgres
+
+Environment=PGROOT=/var/lib/postgres
+Environment=PGLOG=/var/log/postgresql.log
+
SyslogIdentifier=postgres
PIDFile=/var/lib/postgres/data/postmaster.pid
-# initdb script takes care for symlinking $PGROOT to /var/lib/postgres
-ExecStartPre=/usr/lib/systemd/scripts/postgresql-initdb
-ExecStart= /bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgres/data start"
-ExecReload=/bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgres/data reload"
-ExecStop= /bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgres/data stop -m fast"
+ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
+ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
+ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
+ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
-# killing Postgres
+# killing Postgres, so adjust it downward
OOMScoreAdjust=-200
[Install]