From patchwork Mon Feb 4 18:53:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Titouan Christophe X-Patchwork-Id: 1036176 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=railnova.eu Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=railnova-eu.20150623.gappssmtp.com header.i=@railnova-eu.20150623.gappssmtp.com header.b="1gYOItxy"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43tcLx096pz9s4V for ; Tue, 5 Feb 2019 05:54:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7D873869E2; Mon, 4 Feb 2019 18:54:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UchmavBt-KCD; Mon, 4 Feb 2019 18:54:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 97F03864EF; Mon, 4 Feb 2019 18:54:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A41331BF282 for ; Mon, 4 Feb 2019 18:54:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A06E32D944 for ; Mon, 4 Feb 2019 18:54:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xhM09p17RyLV for ; Mon, 4 Feb 2019 18:54:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by silver.osuosl.org (Postfix) with ESMTPS id 1240C2D8AB for ; Mon, 4 Feb 2019 18:54:11 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id h15so829220edb.4 for ; Mon, 04 Feb 2019 10:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=railnova-eu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vqSXR5/LV4eDqW7+e/VrObXb8iG/lDsD//k9apqtubU=; b=1gYOItxyGj53b9cLzGUaKXZSRFca1a2sa8NRtaI2QfZ013dVO8xJw0wWYNx/Bud0qO TO4cypAyIE6IkU9jWHApleEX4Wx0s3S5/MRidr7Qe/L9w4/Y3waeIEjTjPdrqO00JFFZ lCTkK3P+URWwQaodGAdzpa2bErE/zBYb1b036p6/G02Q9c/8w7sWo5F9IajTtDoVg5nm bw+hxjlLvSRMcKGswKI1JzByZAy+H0njuvIHmSjIb7mycjZmX2gSrchPGaHZCEiKXWHu VAQ/73aqrJrj1sxvK7i+ZUSn6ldWSkNeGdV2iiqyKR7AI2UQ2P4CQ34JLD5x/J99HkOb Jf0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vqSXR5/LV4eDqW7+e/VrObXb8iG/lDsD//k9apqtubU=; b=uQzQ2gO/X9zXuagQR05DoI+hp7MDNfSkeMDhAaYSdbiGpql74Vz7p1cOL5bHdqsNge CQWOGu7Xvxc0u8j1LvD538lM+trKlD7RZYX2rsvB887K2A4PxRw9pP2/yJW1SUJzDCH5 OdDCoVyuJaT+gzhQb4P4vZZMD9qQmkvI6JLoysWfWut0Upx4WOykcei/piySuzwEw3A8 gaqGuZ60HVMKDoC+/Ecv2ZINZ6wo0u7a8WEMC1YU5Mg0lztExppo6vWuELOn8Cvqmip5 mmcmAup/WQRaToguTBmzUGtV5F7lrAnCAIVOwhe5KhDAOS20OPYzRyS88JpHkYOnDQcr +psg== X-Gm-Message-State: AHQUAuYl9AB9yGUgC/gA02LsumiavA5SVKlhd7VJbe1zraE6mFNZG4V+ ajZkUAwGKjgK/fK//XrdOMa6RG7xwJlAaUU5 X-Google-Smtp-Source: AHgI3IbrdjjyeSeA+IkFTTW9G9lP34LRxfzdqSVqmVDWtq2lOK1lNYlsRy0I0pBc05PGlVzcCdBOiw== X-Received: by 2002:a17:906:65d0:: with SMTP id z16mr348314ejn.200.1549306449178; Mon, 04 Feb 2019 10:54:09 -0800 (PST) Received: from localhost.localdomain (cust-206-239-109-94.dyn.as47377.net. [94.109.239.206]) by smtp.gmail.com with ESMTPSA id w24-v6sm2632689eja.71.2019.02.04.10.54.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 10:54:08 -0800 (PST) From: Titouan Christophe To: buildroot@buildroot.org Date: Mon, 4 Feb 2019 19:53:40 +0100 Message-Id: <20190204185340.3689-1-titouan.christophe@railnova.eu> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20180629183101.9705-1-joseph.kogut@gmail.com> References: <20180629183101.9705-1-joseph.kogut@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] postgresql: change systemd service type to notify X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joseph Kogut , Peter Seiderer , Titouan Christophe Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Joseph Kogut 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 Signed-off-by: Titouan Christophe --- package/postgresql/postgresql.mk | 8 ++++++++ package/postgresql/postgresql.service | 12 ++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk index c4ba0daa17..fefbcf5f06 100644 --- a/package/postgresql/postgresql.mk +++ b/package/postgresql/postgresql.mk @@ -83,6 +83,14 @@ else POSTGRESQL_CONF_OPTS += --without-libxml 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 postgres -1 postgres -1 * /var/lib/pgsql /bin/sh - PostgreSQL Server endef diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service index 4a96258684..53e6f84f00 100644 --- a/package/postgresql/postgresql.service +++ b/package/postgresql/postgresql.service @@ -3,7 +3,7 @@ Description=PostgreSQL database server After=network.target [Service] -Type=forking +Type=notify # start timeout disabled because initdb may run a little # longer (eg. 5 minutes on RaspberryPi) @@ -12,13 +12,17 @@ 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/pg_ctl start -D /var/lib/pgsql -w -l /var/lib/pgsql/logfile -ExecReload=/usr/bin/pg_ctl reload -D /var/lib/pgsql -ExecStop=/usr/bin/pg_ctl stop -D /var/lib/pgsql -m fast +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