Hi,
This is what my service script looks like:
cat /usr/lib/systemd/system/postgresql-tst.service
[Unit]
Description=postgresql_postgres-tst
After=syslog.target
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
Environment=PGDATA=/data/postgres-tst/data-01/
# Run ExecStartPre with root-permissions
PermissionsStartOnly=true
ExecStartPre=/bin/chown postgres
ostgres /var/run/postgresql
ExecStart=/usr/pgsql-9.6/bin/pg_ctl start -D ${PGDATA}
ExecStop=/usr/pgsql-9.6/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/usr/pgsql-9.6/bin/pg_ctl reload -D ${PGDATA} -s
Restart=on-failure
KillMode=control-group
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
[Install]
WantedBy=multi-user.target
Thanks in advance.
regards
Marian