summaryrefslogtreecommitdiffstats
path: root/postgresql-ctl.in
blob: ad1800484d34b46399944ffaa2e683b12ec5d5d7 (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
#!/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

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

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