[Unit] Description=PostgreSQL database server After=network.target [Service] TimeoutSec=120 User=postgres Group=postgres Environment=PGDATA=/var/lib/postgres/data ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} ExecStart=/usr/bin/postgres ExecReload=/usr/bin/kill -HUP $MAINPID # Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in # killing Postgres, so adjust it downward OOMScoreAdjust=-200 # Additional security-related features PrivateTmp=true ProtectHome=true ProtectSystem=full NoNewPrivileges=true RuntimeDirectory=postgresql RuntimeDirectoryMode=755 [Install] WantedBy=multi-user.target