fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37729?usp=email )
Change subject: contrib: add systemd unit file ......................................................................
contrib: add systemd unit file
Change-Id: I8417821d2d8ead0ab1bcea87ee40a16c1b98ce69 --- M Makefile A contrib/systemd/osmo-s1gw.service 2 files changed, 31 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/29/37729/1
diff --git a/Makefile b/Makefile index 004e189..7fed821 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ # directory paths for 'install' BINDIR ?= /usr/bin CONFDIR ?= /etc/osmocom +SYSTEMDUNITDIR ?= /lib/systemd/system/
all: build
@@ -30,8 +31,10 @@ install: build install -d $(DESTDIR)$(BINDIR) install -d $(DESTDIR)$(CONFDIR) + install -d $(DESTDIR)$(SYSTEMDUNITDIR) install -m 0755 _build/default/bin/osmo-s1gw $(DESTDIR)$(BINDIR) install -m 0644 -T config/sys.config $(DESTDIR)$(CONFDIR)/osmo-s1gw.config + install -m 0644 contrib/systemd/osmo-s1gw.service $(DESTDIR)$(SYSTEMDUNITDIR)
clean: # Avoid running rebar3 clean if _build doesn't exist, since it would try diff --git a/contrib/systemd/osmo-s1gw.service b/contrib/systemd/osmo-s1gw.service new file mode 100644 index 0000000..f19354a --- /dev/null +++ b/contrib/systemd/osmo-s1gw.service @@ -0,0 +1,19 @@ +[Unit] +Description=Osmocom S1 Gateway +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +Restart=always +StateDirectory=osmo-s1gw +WorkingDirectory=%S/osmo-s1gw +User=osmocom +Group=osmocom +Environment="HOME=/var/lib/osmo-s1gw" +Environment="ERL_FLAGS=-config /etc/osmocom/osmo-s1gw.config" +ExecStart=/usr/bin/osmo-s1gw foreground +RestartSec=2 + +[Install] +WantedBy=multi-user.target