Postgresql systemd 启动和停止脚本(10.x)

# It's not recommended to modify this file in-place, because it will be # overwritten during package upgrades.  If you want to customize, the # best way is to create a file "/etc...

# It's not recommended to modify this file in-place, because it will be

# overwritten during package upgrades.  If you want to customize, the

# best way is to create a file "/etc/systemd/system/postgresql-10.service",

# containing

#.include /usr/lib/systemd/system/postgresql-10.service

#...make your changes here...

# For more info about custom unit files, see

# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F


# Note: changing PGDATA will typically require adjusting SELinux

# configuration as well.


# Note: do not use a PGDATA pathname containing spaces, or you will

# break postgresql-setup.

[Unit]

Description=PostgreSQL 10 database server

Documentation=https://www.postgresql.org/docs/10/static/

After=syslog.target

After=network.target


[Service]

Type=notify


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/10/data/


# 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

Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj

Environment=PG_OOM_ADJUST_VALUE=0


ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA}

ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA}

ExecReload=/bin/kill -HUP $MAINPID

KillMode=mixed

KillSignal=SIGINT

 


# Do not set any timeout value, so that systemd will not kill postmaster

# during crash recovery.

TimeoutSec=0


[Install]

WantedBy=multi-user.target


  • 发表于 2018-09-02 17:07
  • 阅读 ( 42 )

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
石天
石天

437 篇文章

作家榜 »

  1. shitian 662 文章
  2. 石天 437 文章
  3. 每天惠23 33 文章
  4. 小A 29 文章