Change in osmo-e1d[master]: add systemd service/unit

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jun 30 19:56:46 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19081 )


Change subject: add systemd service/unit
......................................................................

add systemd service/unit

Change-Id: I956cd9e7ff378a6372524175a1c83416be45610b
---
M Makefile.am
M configure.ac
A contrib/Makefile.am
A contrib/systemd/Makefile.am
A contrib/systemd/osmo-e1d.service
M debian/osmo-e1d.install
6 files changed, 43 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/81/19081/1

diff --git a/Makefile.am b/Makefile.am
index 40dff3f..3f87824 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,7 @@
 AUTOMAKE_OPTIONS = foreign dist-bzip2
 
 SUBDIRS = \
+	contrib \
 	doc \
 	src \
 	include \
@@ -16,6 +17,10 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libosmo-e1d.pc
 
+AM_DISTCHECK_CONFIGURE_FLAGS = \
+	--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
+
 @RELMAKE@
 
 BUILT_SOURCES = $(top_srcdir)/.version
diff --git a/configure.ac b/configure.ac
index 0320b6f..548cc68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,8 +72,26 @@
 	CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
 fi
 
+# https://www.freedesktop.org/software/systemd/man/daemon.html
+AC_ARG_WITH([systemdsystemunitdir],
+     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
+     [with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
+     def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+
+     AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+   [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+    [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
+    with_systemdsystemunitdir=no],
+   [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+      [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
+
 AC_OUTPUT(
 	Makefile
+	contrib/Makefile
+	contrib/systemd/Makefile
 	doc/Makefile
 	doc/examples/Makefile
 	src/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 0000000..3439c97
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 0000000..54c6c6e
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = osmo-e1d.service
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+  osmo-e1d.service
+endif
diff --git a/contrib/systemd/osmo-e1d.service b/contrib/systemd/osmo-e1d.service
new file mode 100644
index 0000000..03ac643
--- /dev/null
+++ b/contrib/systemd/osmo-e1d.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Osmocom E1 Interface Daemon
+Wants=osmo-e1d.service
+
+[Service]
+Type=simple
+Restart=always
+ExecStart=/usr/bin/osmo-e1d -c /etc/osmocom/osmo-e1d.cfg
+RestartSec=2
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/osmo-e1d.install b/debian/osmo-e1d.install
index 7aeba92..80bd25a 100644
--- a/debian/osmo-e1d.install
+++ b/debian/osmo-e1d.install
@@ -1,2 +1,3 @@
 /etc/osmocom/osmo-e1d.cfg
+lib/systemd/system/osmo-e1d.service
 usr/bin/osmo-e1d

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19081
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I956cd9e7ff378a6372524175a1c83416be45610b
Gerrit-Change-Number: 19081
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200630/2ef77b97/attachment.htm>


More information about the gerrit-log mailing list