fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/43636?usp=email )
Change subject: contrib/systemd: add a service file for osmo-trx-proxy ......................................................................
contrib/systemd: add a service file for osmo-trx-proxy
Add osmo-trx-proxy.service, and package it in osmo-trx-proxy along with the postinst logic to create the 'osmocom' system user/group it runs as, matching the other osmo-trx-* backends.
Change-Id: I8c5bc092dc5bf6bf07d6e80f64ac7fc06f0cfb96 Related: OS#6672 --- M contrib/systemd/Makefile.am A contrib/systemd/osmo-trx-proxy.service M debian/osmo-trx-proxy.install A debian/osmo-trx-proxy.postinst 4 files changed, 52 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/36/43636/1
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am index 6566b97..b8cd7eb 100644 --- a/contrib/systemd/Makefile.am +++ b/contrib/systemd/Makefile.am @@ -2,7 +2,8 @@ osmo-trx-lms.service \ osmo-trx-uhd.service \ osmo-trx-usrp1.service \ - osmo-trx-ipc.service + osmo-trx-ipc.service \ + osmo-trx-proxy.service
if HAVE_SYSTEMD SYSTEMD_SERVICES = @@ -23,5 +24,9 @@ SYSTEMD_SERVICES += osmo-trx-ipc.service endif
+if ENABLE_PROXY +SYSTEMD_SERVICES += osmo-trx-proxy.service +endif + systemdsystemunit_DATA = $(SYSTEMD_SERVICES) endif # HAVE_SYSTEMD diff --git a/contrib/systemd/osmo-trx-proxy.service b/contrib/systemd/osmo-trx-proxy.service new file mode 100644 index 0000000..8d79933 --- /dev/null +++ b/contrib/systemd/osmo-trx-proxy.service @@ -0,0 +1,23 @@ +[Unit] +Description=Osmocom Virtual TRX Endpoint Proxy +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +Restart=always +StateDirectory=osmocom +WorkingDirectory=%S/osmocom +User=osmocom +Group=osmocom +ExecStart=/usr/bin/osmo-trx-proxy -c /etc/osmocom/osmo-trx-proxy.cfg +RestartSec=2 +AmbientCapabilities=CAP_SYS_NICE +# CPU scheduling policy: +CPUSchedulingPolicy=rr +# For real-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority): +CPUSchedulingPriority=21 +# See sched(7) for further details on real-time policies and priorities + +[Install] +WantedBy=multi-user.target diff --git a/debian/osmo-trx-proxy.install b/debian/osmo-trx-proxy.install index d0309eb..0a3cb05 100644 --- a/debian/osmo-trx-proxy.install +++ b/debian/osmo-trx-proxy.install @@ -1,3 +1,4 @@ etc/osmocom/osmo-trx-proxy.cfg +lib/systemd/system/osmo-trx-proxy.service usr/bin/osmo-trx-proxy usr/share/doc/osmo-trx/examples/osmo-trx-proxy/osmo-trx-proxy.cfg /usr/share/doc/osmo-trx/examples/osmo-trx-proxy/ diff --git a/debian/osmo-trx-proxy.postinst b/debian/osmo-trx-proxy.postinst new file mode 100755 index 0000000..d4857a2 --- /dev/null +++ b/debian/osmo-trx-proxy.postinst @@ -0,0 +1,22 @@ +#!/bin/sh -e +case "$1" in + configure) + # Create the osmocom group and user (if it doesn't exist yet) + if ! getent group osmocom >/dev/null; then + groupadd --system osmocom + fi + if ! getent passwd osmocom >/dev/null; then + useradd \ + --system \ + --gid osmocom \ + --home-dir /var/lib/osmocom \ + --shell /sbin/nologin \ + --comment "Open Source Mobile Communications" \ + osmocom + fi + ;; +esac + +# dh_installdeb(1) will replace this with shell code automatically +# generated by other debhelper scripts. +#DEBHELPER#