vi /usr/lib/systemd/system/postgresql.service
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0
Environment=PGSTARTTIMEOUT=300
Environment=PGDATA=/pgccc/pgdata
ExecStart=/pgccc/app/14.8/bin/pg_ctl start -D ${PGDATA} -s -w -t ${PGSTARTTIMEOUT}
ExecStop=/pgccc/app/14.8/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/pgccc/app/14.8/bin/pg_ctl reload -D ${PGDATA} -s
[Install]
WantedBy=multi-user.target
[Postgresql systemctl 启动设置与问题_51CTO博客_systemctl set-default multi-user.target](https://blog.51cto.com/u_14150796/6534718)