summaryrefslogtreecommitdiffstats
path: root/postgresql.service.in
diff options
context:
space:
mode:
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]