1
0

postgresql.service 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. [Unit]
  2. Description=PostgreSQL database server
  3. After=network.target
  4. [Service]
  5. Type=forking
  6. User=postgres
  7. Group=postgres
  8. # Where to send early-startup messages from the server (before the logging
  9. # options of postgresql.conf take effect)
  10. # This is normally controlled by the global default set by systemd
  11. # StandardOutput=syslog
  12. # Disable OOM kill on the postmaster
  13. OOMScoreAdjust=-1000
  14. # ... but allow it still to be effective for child processes
  15. # (note that these settings are ignored by Postgres releases before 9.5)
  16. Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
  17. Environment=PG_OOM_ADJUST_VALUE=0
  18. # Maximum number of seconds pg_ctl will wait for postgres to start. Note that
  19. # PGSTARTTIMEOUT should be less than TimeoutSec value.
  20. Environment=PGSTARTTIMEOUT=270
  21. Environment=PGDATA=/data/pgsql
  22. ExecStart=/usr/local/pgsql/bin/pg_ctl start -D ${PGDATA} -s -w -t ${PGSTARTTIMEOUT}
  23. ExecStop=/usr/local/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
  24. ExecReload=/usr/local/pgsql/bin/pg_ctl reload -D ${PGDATA} -s
  25. # Give a reasonable amount of time for the server to start up/shut down.
  26. # Ideally, the timeout for starting PostgreSQL server should be handled more
  27. # nicely by pg_ctl in ExecStart, so keep its timeout smaller than this value.
  28. TimeoutSec=300
  29. [Install]
  30. WantedBy=multi-user.target