kumquat-buildroot/package/postgresql/postgresql.service
Joseph Kogut eada187e77 package/postgresql: change systemd service type to notify
During activation, pg_ctl uses exec to start the db server, which causes
the service to never finish activating when Type=forking. Upstream
recommends configuring --with-systemd and using Type=notify.

https://www.postgresql.org/docs/10/static/server-start.html

Upstream says:
    When using systemd, you can use the following service unit file
    [...]
    Using Type=notify requires that the server binary was built with
    configure --with-systemd.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-02-06 12:54:17 +01:00

29 lines
629 B
Desktop File

[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=notify
# start timeout disabled because initdb may run a little
# longer (eg. 5 minutes on RaspberryPi)
TimeoutStartSec=0
User=postgres
Group=postgres
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=postgres
PIDFile=/var/lib/pgsql/postmaster.pid
ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql; fi"
ExecStart=/usr/bin/postgres -D /var/lib/pgsql
ExecReload=/usr/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target