From 9c2c2654baef5ac47a55c2a278637039c8e95a01 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 30 Aug 2022 19:51:47 +0700 Subject: [PATCH] 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: I67564759f43193f4739b0b194d5f5da92e3bc6ae --- contrib/systemd/osmo-hnodeb.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/systemd/osmo-hnodeb.service b/contrib/systemd/osmo-hnodeb.service index 037e0e8..d7e26d8 100644 --- a/contrib/systemd/osmo-hnodeb.service +++ b/contrib/systemd/osmo-hnodeb.service @@ -3,6 +3,8 @@ Description=Osmocom Home NodeB (hNodeB) [Service] Type=simple +StateDirectory=osmocom +WorkingDirectory=%S/osmocom Restart=always ExecStart=/usr/bin/osmo-hnodeb -c /etc/osmocom/osmo-hnodeb.cfg RestartSec=2