summaryrefslogtreecommitdiffstats
path: root/postgresql-ctl.in
blob: 569e4d3d8ba3f5cc1e680301d6f3c4a5aa8cafc7 (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
26
27
28
29
30
31
#!/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@

# Help users to run postgresql server extensions built against specific
# software collection (that said, such collection is runtime dependancy of
# such extension, not the server itself).
test -n "$PGSCLS" && source scl_source enable $PGSCLS

opts=()
test "$1" = "start" && test -n "$PGOPTS" && opts=(-o "$PGOPTS")

# cleanup possibly empty PGPORT
test -z "$PGPORT" && unset PGPORT

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