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