summaryrefslogtreecommitdiffstats
path: root/postgresql-ctl.in
blob: 546ffba30a99d9a2e892db113b3dc7fc36b03100 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

# Thin wrapper arount pg_ctl.
#
# This file exists for the following reasons:
#
# * It is s compat-wrapper for the cases when PGPORT *is* set directly in
#   postgresql.service (nowadays users should configure port directly in
#   postgresql.conf).  This is hack which allows us to do a conditional step
#   before running pg_ctl (which is not allowed by systemd).
#
# * This helper script is necessary for having proper SELinux context of daemon
#   process run in SCL environment via systemd/sysvinit service file.  Without
#   this script the process looses SELinux type because /usr/bin/scl
#   has context bin_t and 'unit_t -> bin_t' results in unconfined process.
#   This file must thus have 'postgresql_exec_t' fcontext.

@SCL_SOURCE@

port=()
if test "$1" = "start" && test -n "$PGPORT"; then
    port=(-o "-p $PGPORT")
fi

exec @bindir@/pg_ctl "$@" "${port[@]}"