* [Buildroot] [PATCH v2] postgresql: add systemd service file
@ 2014-05-20 21:16 Peter Seiderer
2014-06-11 20:33 ` Thomas Petazzoni
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Peter Seiderer @ 2014-05-20 21:16 UTC (permalink / raw)
To: buildroot
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v1 -> v2:
- add '-w' (wait) to pg_ctl start command (to ensure pid
file generation)
---
package/postgresql/postgresql.mk | 8 ++++++++
package/postgresql/postgresql.service | 24 ++++++++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 package/postgresql/postgresql.service
diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
index b331737..cf4700a 100644
--- a/package/postgresql/postgresql.mk
+++ b/package/postgresql/postgresql.mk
@@ -58,4 +58,12 @@ define POSTGRESQL_INSTALL_INIT_SYSV
$(TARGET_DIR)/etc/init.d/S50postgresql
endef
+define POSTGRESQL_INSTALL_INIT_SYSTEMD
+ $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
+ $(TARGET_DIR)/etc/systemd/system/postgresql.service
+ mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+ ln -fs ../postgresql.service \
+ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
+endef
+
$(eval $(autotools-package))
diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
new file mode 100644
index 0000000..4a96258
--- /dev/null
+++ b/package/postgresql/postgresql.service
@@ -0,0 +1,24 @@
+[Unit]
+Description=PostgreSQL database server
+After=network.target
+
+[Service]
+Type=forking
+
+# start timeout disabled because initdb may run a little
+# longer (eg. 5 minutes on RaspberryPi)
+TimeoutStartSec=0
+
+User=postgres
+Group=postgres
+
+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
+
+[Install]
+WantedBy=multi-user.target
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v2] postgresql: add systemd service file
2014-05-20 21:16 [Buildroot] [PATCH v2] postgresql: add systemd service file Peter Seiderer
@ 2014-06-11 20:33 ` Thomas Petazzoni
2014-07-31 22:13 ` Thomas Petazzoni
2014-10-12 15:29 ` Arnout Vandecappelle
2015-01-10 18:06 ` Thomas Petazzoni
2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2014-06-11 20:33 UTC (permalink / raw)
To: buildroot
Eric,
As our systemd person, could you review this patch, and give your
comments and/or Acked-by/Reviewed-by as appropriate?
Thanks,
Thomas
On Tue, 20 May 2014 23:16:51 +0200, Peter Seiderer wrote:
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
> Changes v1 -> v2:
> - add '-w' (wait) to pg_ctl start command (to ensure pid
> file generation)
> ---
> package/postgresql/postgresql.mk | 8 ++++++++
> package/postgresql/postgresql.service | 24 ++++++++++++++++++++++++
> 2 files changed, 32 insertions(+)
> create mode 100644 package/postgresql/postgresql.service
>
> diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
> index b331737..cf4700a 100644
> --- a/package/postgresql/postgresql.mk
> +++ b/package/postgresql/postgresql.mk
> @@ -58,4 +58,12 @@ define POSTGRESQL_INSTALL_INIT_SYSV
> $(TARGET_DIR)/etc/init.d/S50postgresql
> endef
>
> +define POSTGRESQL_INSTALL_INIT_SYSTEMD
> + $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
> + $(TARGET_DIR)/etc/systemd/system/postgresql.service
> + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> + ln -fs ../postgresql.service \
> + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
> +endef
> +
> $(eval $(autotools-package))
> diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
> new file mode 100644
> index 0000000..4a96258
> --- /dev/null
> +++ b/package/postgresql/postgresql.service
> @@ -0,0 +1,24 @@
> +[Unit]
> +Description=PostgreSQL database server
> +After=network.target
> +
> +[Service]
> +Type=forking
> +
> +# start timeout disabled because initdb may run a little
> +# longer (eg. 5 minutes on RaspberryPi)
> +TimeoutStartSec=0
> +
> +User=postgres
> +Group=postgres
> +
> +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
> +
> +[Install]
> +WantedBy=multi-user.target
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v2] postgresql: add systemd service file
2014-06-11 20:33 ` Thomas Petazzoni
@ 2014-07-31 22:13 ` Thomas Petazzoni
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2014-07-31 22:13 UTC (permalink / raw)
To: buildroot
Eric,
Another ping about this patch :-)
Thanks,
Thomas
On Wed, 11 Jun 2014 22:33:42 +0200, Thomas Petazzoni wrote:
> Eric,
>
> As our systemd person, could you review this patch, and give your
> comments and/or Acked-by/Reviewed-by as appropriate?
>
> Thanks,
>
> Thomas
>
> On Tue, 20 May 2014 23:16:51 +0200, Peter Seiderer wrote:
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> > ---
> > Changes v1 -> v2:
> > - add '-w' (wait) to pg_ctl start command (to ensure pid
> > file generation)
> > ---
> > package/postgresql/postgresql.mk | 8 ++++++++
> > package/postgresql/postgresql.service | 24 ++++++++++++++++++++++++
> > 2 files changed, 32 insertions(+)
> > create mode 100644 package/postgresql/postgresql.service
> >
> > diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
> > index b331737..cf4700a 100644
> > --- a/package/postgresql/postgresql.mk
> > +++ b/package/postgresql/postgresql.mk
> > @@ -58,4 +58,12 @@ define POSTGRESQL_INSTALL_INIT_SYSV
> > $(TARGET_DIR)/etc/init.d/S50postgresql
> > endef
> >
> > +define POSTGRESQL_INSTALL_INIT_SYSTEMD
> > + $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
> > + $(TARGET_DIR)/etc/systemd/system/postgresql.service
> > + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> > + ln -fs ../postgresql.service \
> > + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
> > +endef
> > +
> > $(eval $(autotools-package))
> > diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
> > new file mode 100644
> > index 0000000..4a96258
> > --- /dev/null
> > +++ b/package/postgresql/postgresql.service
> > @@ -0,0 +1,24 @@
> > +[Unit]
> > +Description=PostgreSQL database server
> > +After=network.target
> > +
> > +[Service]
> > +Type=forking
> > +
> > +# start timeout disabled because initdb may run a little
> > +# longer (eg. 5 minutes on RaspberryPi)
> > +TimeoutStartSec=0
> > +
> > +User=postgres
> > +Group=postgres
> > +
> > +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
> > +
> > +[Install]
> > +WantedBy=multi-user.target
>
>
>
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v2] postgresql: add systemd service file
2014-05-20 21:16 [Buildroot] [PATCH v2] postgresql: add systemd service file Peter Seiderer
2014-06-11 20:33 ` Thomas Petazzoni
@ 2014-10-12 15:29 ` Arnout Vandecappelle
2015-01-10 18:06 ` Thomas Petazzoni
2 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2014-10-12 15:29 UTC (permalink / raw)
To: buildroot
On 20/05/14 23:16, Peter Seiderer wrote:
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Looks good. It has two things that aren't present in the sysvinit start script,
though:
- the -w option mentioned below;
- the Reload option (sysvinit just restarts).
But both are a good idea.
Regards,
Arnout
> ---
> Changes v1 -> v2:
> - add '-w' (wait) to pg_ctl start command (to ensure pid
> file generation)
> ---
> package/postgresql/postgresql.mk | 8 ++++++++
> package/postgresql/postgresql.service | 24 ++++++++++++++++++++++++
> 2 files changed, 32 insertions(+)
> create mode 100644 package/postgresql/postgresql.service
>
> diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
> index b331737..cf4700a 100644
> --- a/package/postgresql/postgresql.mk
> +++ b/package/postgresql/postgresql.mk
> @@ -58,4 +58,12 @@ define POSTGRESQL_INSTALL_INIT_SYSV
> $(TARGET_DIR)/etc/init.d/S50postgresql
> endef
>
> +define POSTGRESQL_INSTALL_INIT_SYSTEMD
> + $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
> + $(TARGET_DIR)/etc/systemd/system/postgresql.service
> + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> + ln -fs ../postgresql.service \
> + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
> +endef
> +
> $(eval $(autotools-package))
> diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
> new file mode 100644
> index 0000000..4a96258
> --- /dev/null
> +++ b/package/postgresql/postgresql.service
> @@ -0,0 +1,24 @@
> +[Unit]
> +Description=PostgreSQL database server
> +After=network.target
> +
> +[Service]
> +Type=forking
> +
> +# start timeout disabled because initdb may run a little
> +# longer (eg. 5 minutes on RaspberryPi)
> +TimeoutStartSec=0
> +
> +User=postgres
> +Group=postgres
> +
> +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
> +
> +[Install]
> +WantedBy=multi-user.target
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v2] postgresql: add systemd service file
2014-05-20 21:16 [Buildroot] [PATCH v2] postgresql: add systemd service file Peter Seiderer
2014-06-11 20:33 ` Thomas Petazzoni
2014-10-12 15:29 ` Arnout Vandecappelle
@ 2015-01-10 18:06 ` Thomas Petazzoni
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2015-01-10 18:06 UTC (permalink / raw)
To: buildroot
Dear Peter Seiderer,
On Tue, 20 May 2014 23:16:51 +0200, Peter Seiderer wrote:
> +define POSTGRESQL_INSTALL_INIT_SYSTEMD
> + $(INSTALL) -D -m 644 package/postgresql/postgresql.service \
> + $(TARGET_DIR)/etc/systemd/system/postgresql.service
> + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> + ln -fs ../postgresql.service \
> + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/postgresql.service
> +endef
Tabs should have been used instead of spaces for indentation. I've
fixed that up, and committed.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-10 18:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20 21:16 [Buildroot] [PATCH v2] postgresql: add systemd service file Peter Seiderer
2014-06-11 20:33 ` Thomas Petazzoni
2014-07-31 22:13 ` Thomas Petazzoni
2014-10-12 15:29 ` Arnout Vandecappelle
2015-01-10 18:06 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox