diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2015-03-19 12:53:28 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2015-03-19 12:56:38 +0100 |
commit | 8c7b2cd5f6d9efb59568382cd8b6e88d9be517bb (patch) | |
tree | eaba95c6d219f5f9bed707ea578e6358b0aace59 /postgresql.init.in | |
parent | 00b185f55bf37dfb5c29220218ff6e4a078a71db (diff) | |
download | postgresql-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.init.in')
-rw-r--r-- | postgresql.init.in | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/postgresql.init.in b/postgresql.init.in index 70058d6..ca0909e 100644 --- a/postgresql.init.in +++ b/postgresql.init.in @@ -73,6 +73,7 @@ PG_OOM_ADJ=-17 export PGDATA export PGPORT +export PGSTARTTIMEOUT lockfile="/var/lock/subsys/${NAME}" @@ -111,13 +112,22 @@ start() # is already running. We should probably 'status' first and start only if # postmaster is down. This just unnecessarily wastes time and generates # too much (false) rush in $PGLOG. + # + # The maximum waiting time PGSTARTTIMEOUT is set to 30 second to not hold + # the system too long. See `man pg_ctl & -w option`. This is not issue in + # case of systemd. + run_cmd_as_dbadmin \ - "$PGENGINE/postgres ${PGPORT+-o "-p $PGPORT"} \ - -D '$PGDATA' ${PGOPTS} &" \ + "@libexecdir@/postgresql-ctl start -D ${PGDATA} -s \ + -w -t ${PGSTARTTIMEOUT-30}" \ "$PGLOG" "$PGLOG" - # TODO: parametrize - sleep 2 + if test $? -ne 0; then + failure "$PSQL_START" + echo + script_result=1 + return + fi pid=`head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null` if [ "x$pid" != x ] |