Skip to content

Instantly share code, notes, and snippets.

@mche
Last active October 30, 2017 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mche/3824b42cd65d2686d74dbaf68a0c753f to your computer and use it in GitHub Desktop.
Save mche/3824b42cd65d2686d74dbaf68a0c753f to your computer and use it in GitHub Desktop.
Debian systemd init postgresql
# /etc/systemd/system/uniost-postgresql.service
[Unit]
Description=PostgreSQL uniost user
After=network.target
[Service]
Type=forking
PIDFile=/home/uniost/postgresql/data/postmaster.pid
WorkingDirectory=/home/uniost/postgresql/data
User=uniost
Group=uniost
Environment=PGROOT=/home/uniost/postgresql/data
#OOMScoreAdjust=-200
ExecStart=/home/uniost/postgresql/bin/pg_ctl start -D ${PGROOT} -l ${PGROOT}/logfile
ExecStop=/home/uniost/postgresql/bin/pg_ctl stop -D ${PGROOT} -l ${PGROOT}/logfile -m fast
ExecReload=/home/uniost/postgresql/bin/pg_ctl reload -D ${PGROOT} -l ${PGROOT}/logfile
TimeoutSec=120
#Restart=always
#RemainAfterExit=on
[Install]
WantedBy=multi-user.target
#Alias=uniost-postgresql.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment