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