fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37729?usp=email )
Change subject: contrib: add systemd unit file ......................................................................
contrib: add systemd unit file
Related: SYS#7040 Change-Id: I8417821d2d8ead0ab1bcea87ee40a16c1b98ce69 --- M Makefile A contrib/systemd/osmo-s1gw.service 2 files changed, 22 insertions(+), 0 deletions(-)
Approvals: osmith: Looks good to me, approved Jenkins Builder: Verified
diff --git a/Makefile b/Makefile index 52390d1..ad7b531 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ # directory paths for 'install' BINDIR ?= /usr/bin CONFDIR ?= /etc/osmocom +SYSTEMDUNITDIR ?= /lib/systemd/system
all: build
@@ -34,6 +35,8 @@ $(DESTDIR)$(BINDIR)/osmo-s1gw install -Dm0644 config/sys.config \ $(DESTDIR)$(CONFDIR)/osmo-s1gw.config + install -Dm0644 contrib/systemd/osmo-s1gw.service \ + $(DESTDIR)$(SYSTEMDUNITDIR)/osmo-s1gw.service
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