1 |
[Unit] |
2 |
Description=PostgreSQL database server |
3 |
After=network.target |
4 |
|
5 |
[Service] |
6 |
Type=forking |
7 |
PIDFile=/var/lib/pgsql/data/postmaster.pid |
8 |
|
9 |
User=postgres |
10 |
Group=postgres |
11 |
|
12 |
# Port number for server to listen on |
13 |
Environment=PGPORT=5432 |
14 |
|
15 |
# Location of database directory |
16 |
Environment=PGDATA=/var/lib/pgsql/data |
17 |
|
18 |
# Where to send early-startup messages from the server (before the logging |
19 |
# options of postgresql.conf take effect) |
20 |
# This is normally controlled by the global default set by systemd |
21 |
# StandardOutput=syslog |
22 |
|
23 |
# Disable OOM kill on the postmaster |
24 |
OOMScoreAdjust=-1000 |
25 |
|
26 |
ExecStartPre=/usr/libexec/postgresql_initdb.sh ${PGDATA} |
27 |
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300 |
28 |
ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast |
29 |
ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s |
30 |
|
31 |
# Give a reasonable amount of time for the server to start up/shut down |
32 |
TimeoutSec=300 |
33 |
|
34 |
[Install] |
35 |
WantedBy=multi-user.target |