msuraev submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve msuraev: Looks good to me, approved
Set working directory in systemd service file

By default systemd will execute service with root directory (or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it to 'osmocom' subdir of state directory (/var/lib for system
instance) instead.

Related: OS#4821
Change-Id: I40b5d50470cb55ca94af5e17f21658181a02d4c2
---
M contrib/systemd/osmo-hlr.service
M debian/osmo-hlr.install
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/systemd/osmo-hlr.service b/contrib/systemd/osmo-hlr.service
index 2eea0c4..aa2f281 100644
--- a/contrib/systemd/osmo-hlr.service
+++ b/contrib/systemd/osmo-hlr.service
@@ -5,6 +5,8 @@
[Service]
Type=simple
Restart=always
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
ExecStart=/usr/bin/osmo-hlr -c /etc/osmocom/osmo-hlr.cfg -l /var/lib/osmocom/hlr.db
RestartSec=2

diff --git a/debian/osmo-hlr.install b/debian/osmo-hlr.install
index 421d5f4..8b4039f 100644
--- a/debian/osmo-hlr.install
+++ b/debian/osmo-hlr.install
@@ -6,4 +6,3 @@
/usr/share/doc/osmo-hlr/sql/hlr_data.sql
/usr/share/doc/osmo-hlr/examples/osmo-hlr.cfg
/usr/share/osmocom/osmo-hlr-post-upgrade.sh
-/var/lib/osmocom

To view, visit change 29225. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I40b5d50470cb55ca94af5e17f21658181a02d4c2
Gerrit-Change-Number: 29225
Gerrit-PatchSet: 1
Gerrit-Owner: msuraev <msuraev@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: msuraev <msuraev@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged