|
|
6cb03e |
# It's not recommended to modify this file in-place, because it will be
|
|
|
6cb03e |
# overwritten during package upgrades. If you want to customize, the
|
|
|
6cb03e |
# best way is to create a file "/etc/systemd/system/postgresql.service",
|
|
|
6cb03e |
# containing
|
|
|
6cb03e |
# .include /lib/systemd/system/postgresql.service
|
|
|
6cb03e |
# ...make your changes here...
|
|
|
6cb03e |
# For more info about custom unit files, see
|
|
|
6cb03e |
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
|
|
|
6cb03e |
|
|
|
6cb03e |
# For example, if you want to change the server's port number to 5433,
|
|
|
6cb03e |
# create a file named "/etc/systemd/system/postgresql.service" containing:
|
|
|
6cb03e |
# .include /lib/systemd/system/postgresql.service
|
|
|
6cb03e |
# [Service]
|
|
|
6cb03e |
# Environment=PGPORT=5433
|
|
|
6cb03e |
# This will override the setting appearing below.
|
|
|
6cb03e |
|
|
|
6cb03e |
# Note: changing PGPORT or PGDATA will typically require adjusting SELinux
|
|
|
6cb03e |
# configuration as well; see /usr/share/doc/postgresql-*/README.rpm-dist.
|
|
|
6cb03e |
|
|
|
6cb03e |
# Note: do not use a PGDATA pathname containing spaces, or you will
|
|
|
6cb03e |
# break postgresql-setup.
|
|
|
6cb03e |
|
|
|
6cb03e |
# Note: in F-17 and beyond, /usr/lib/... is recommended in the .include line
|
|
|
6cb03e |
# though /lib/... will still work.
|
|
|
6cb03e |
|
|
|
6cb03e |
[Unit]
|
|
|
6cb03e |
Description=PostgreSQL database server
|
|
|
6cb03e |
After=network.target
|
|
|
6cb03e |
|
|
|
6cb03e |
[Service]
|
|
|
6cb03e |
Type=forking
|
|
|
6cb03e |
|
|
|
6cb03e |
User=postgres
|
|
|
6cb03e |
Group=postgres
|
|
|
6cb03e |
|
|
|
6cb03e |
# Port number for server to listen on
|
|
|
6cb03e |
Environment=PGPORT=5432
|
|
|
6cb03e |
|
|
|
6cb03e |
# Location of database directory
|
|
|
6cb03e |
Environment=PGDATA=/var/lib/pgsql/data
|
|
|
6cb03e |
|
|
|
6cb03e |
# Where to send early-startup messages from the server (before the logging
|
|
|
6cb03e |
# options of postgresql.conf take effect)
|
|
|
6cb03e |
# This is normally controlled by the global default set by systemd
|
|
|
6cb03e |
# StandardOutput=syslog
|
|
|
6cb03e |
|
|
|
6cb03e |
# Disable OOM kill on the postmaster
|
|
|
6cb03e |
OOMScoreAdjust=-1000
|
|
|
6cb03e |
|
|
|
6cb03e |
ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
|
|
|
6cb03e |
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
|
|
|
6cb03e |
ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast
|
|
|
6cb03e |
ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s
|
|
|
6cb03e |
|
|
|
6cb03e |
# Give a reasonable amount of time for the server to start up/shut down
|
|
|
6cb03e |
TimeoutSec=300
|
|
|
6cb03e |
|
|
|
6cb03e |
[Install]
|
|
|
6cb03e |
WantedBy=multi-user.target
|