1[Unit] 2Description=PostgreSQL database server 3After=network.target 4 5[Service] 6Type=forking 7User=postgres 8Group=postgres 9 10# Port number for server to listen on 11Environment=PGPORT=5432 12 13# Location of database directory 14Environment=PGDATA=/var/lib/postgresql/data 15 16# Disable OOM kill on the postmaster 17OOMScoreAdjust=-17 18 19ExecStart=@BINDIR@/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300 20ExecStop=@BINDIR@/pg_ctl stop -D ${PGDATA} -s -m fast 21ExecReload=@BINDIR@/pg_ctl reload -D ${PGDATA} -s 22 23# Give a reasonable amount of time for the server to start up/shut down 24TimeoutSec=300 25 26[Install] 27WantedBy=multi-user.target 28