summaryrefslogtreecommitdiffstats
path: root/postgresql.service.in
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-03-19 12:53:28 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-03-19 12:56:38 +0100
commit8c7b2cd5f6d9efb59568382cd8b6e88d9be517bb (patch)
treeeaba95c6d219f5f9bed707ea578e6358b0aace59 /postgresql.service.in
parent00b185f55bf37dfb5c29220218ff6e4a078a71db (diff)
downloadpostgresql-setup-8c7b2cd5f6d9efb59568382cd8b6e88d9be517bb.tar.gz
postgresql-setup-8c7b2cd5f6d9efb59568382cd8b6e88d9be517bb.tar.xz
postgresql-setup-8c7b2cd5f6d9efb59568382cd8b6e88d9be517bb.zip
init: add PGSTARTTIMEOUT config env variable
* postgresql.init.in (PGSTARTTIMEOUT): New variable. (start): Use postgresql-ctl and respect PGSTARTTIMEOUT. * postgresql.service.in: Better document the timeouts. (PGSTARTTIMEOUT): New env variable. (ExecStart): Respect PGSTARTTIMEOUT. * NEWS: Document.
Diffstat (limited to 'postgresql.service.in')
-rw-r--r--postgresql.service.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/postgresql.service.in b/postgresql.service.in
index 897f732..aac0054 100644
--- a/postgresql.service.in
+++ b/postgresql.service.in
@@ -26,6 +26,10 @@ OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0
+# Maximum number of seconds pg_ctl will wait for postgres to start. Note that
+# PGSTARTTIMEOUT should be less than TimeoutSec value.
+Environment=PGSTARTTIMEOUT=270
+
@PGDATA_ENVIRONMENT@
ExecStartPre=@libexecdir@/postgresql-check-db-dir %N
@@ -33,11 +37,13 @@ ExecStartPre=@libexecdir@/postgresql-check-db-dir %N
# Use convenient postgresql-ctl wrapper instead of directly pg_ctl. See the
# postgresql-ctl file itself for more info.
-ExecStart=@libexecdir@/postgresql-ctl start -D ${PGDATA} -s -w -t 300
+ExecStart=@libexecdir@/postgresql-ctl start -D ${PGDATA} -s -w -t ${PGSTARTTIMEOUT}
ExecStop=@libexecdir@/postgresql-ctl stop -D ${PGDATA} -s -m fast
ExecReload=@libexecdir@/postgresql-ctl reload -D ${PGDATA} -s
-# Give a reasonable amount of time for the server to start up/shut down
+# Give a reasonable amount of time for the server to start up/shut down.
+# Ideally, the timeout for starting PostgreSQL server should be handled more
+# nicely by pg_ctl in ExecStart, so keep its timeout smaller than this value.
TimeoutSec=300
[Install]