Created
July 20, 2016 09:55
-
-
Save kmoppel/44ee5f45b3e7c87215857e975b6a948d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample init script for Centos 7 | |
# Place the file in /usr/lib/systemd/system/postgresql-9.5-custom.service | |
# | |
# systemctl enable postgresql-9.5-custom.service | |
# systemctl status postgresql-9.5-custom.service | |
# Note: do not use a PGDATA pathname containing spaces, or you will | |
# break postgresql-setup. | |
[Unit] | |
Description=Custom PostgreSQL 9.5 database server | |
After=syslog.target | |
After=network.target | |
[Service] | |
Type=forking | |
User=postgres | |
Group=postgres | |
# Note: avoid inserting whitespace in these Environment= lines, or you may | |
# break postgresql-setup. | |
# Location of database directory | |
Environment=PGDATA=/var/lib/pgsql/9.5/data_custom/ | |
# Where to send early-startup messages from the server (before the logging | |
# options of postgresql.conf take effect) | |
# This is normally controlled by the global default set by systemd | |
# StandardOutput=syslog | |
# Disable OOM kill on the postmaster | |
OOMScoreAdjust=-1000 | |
ExecStart=/usr/local/pgsql_9.5/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 | |
ExecStop=/usr/local/pgsql_9.5/bin/pg_ctl stop -D ${PGDATA} -s -m fast | |
ExecReload=/usr/local/pgsql_9.5/bin/pg_ctl reload -D ${PGDATA} -s | |
# Give a reasonable amount of time for the server to start up/shut down | |
TimeoutSec=300 | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment