mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 21:26:36 +00:00
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>
This commit is contained in:
parent
5097295a4d
commit
eada187e77
@ -83,6 +83,14 @@ else
|
|||||||
POSTGRESQL_CONF_OPTS += --without-libxml
|
POSTGRESQL_CONF_OPTS += --without-libxml
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# required for postgresql.service Type=notify
|
||||||
|
ifeq ($(BR2_PACKAGE_SYSTEMD),y)
|
||||||
|
POSTGRESQL_DEPENDENCIES += systemd
|
||||||
|
POSTGRESQL_CONF_OPTS += --with-systemd
|
||||||
|
else
|
||||||
|
POSTGRESQL_CONF_OPTS += --without-systemd
|
||||||
|
endif
|
||||||
|
|
||||||
define POSTGRESQL_USERS
|
define POSTGRESQL_USERS
|
||||||
postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
|
postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server
|
||||||
endef
|
endef
|
||||||
|
@ -3,7 +3,7 @@ Description=PostgreSQL database server
|
|||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=notify
|
||||||
|
|
||||||
# start timeout disabled because initdb may run a little
|
# start timeout disabled because initdb may run a little
|
||||||
# longer (eg. 5 minutes on RaspberryPi)
|
# longer (eg. 5 minutes on RaspberryPi)
|
||||||
@ -12,13 +12,17 @@ TimeoutStartSec=0
|
|||||||
User=postgres
|
User=postgres
|
||||||
Group=postgres
|
Group=postgres
|
||||||
|
|
||||||
|
StandardOutput=syslog
|
||||||
|
StandardError=syslog
|
||||||
SyslogIdentifier=postgres
|
SyslogIdentifier=postgres
|
||||||
PIDFile=/var/lib/pgsql/postmaster.pid
|
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"
|
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/pg_ctl start -D /var/lib/pgsql -w -l /var/lib/pgsql/logfile
|
ExecStart=/usr/bin/postgres -D /var/lib/pgsql
|
||||||
ExecReload=/usr/bin/pg_ctl reload -D /var/lib/pgsql
|
ExecReload=/usr/bin/kill -HUP $MAINPID
|
||||||
ExecStop=/usr/bin/pg_ctl stop -D /var/lib/pgsql -m fast
|
KillMode=mixed
|
||||||
|
KillSignal=SIGINT
|
||||||
|
TimeoutSec=0
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user