- 新增一个名称为postgresql-9的服务并编辑该文件
- vim /usr/lib/systemd/system/postgresql-9.service
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
Environment=PGPORT=5432
Environment=PGDATA=/usr/local/postgresql_data/
ExecStart=/usr/pgsql-9.5/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
ExecStop=/usr/pgsql-9.5/bin/pg_ctl stop -D ${PGDATA} -s -m fast
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start postgresql-9
systemctl enable postgresql-9