aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/systemd
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2022-09-09 20:46:33 +0700
committerMax <msuraev@sysmocom.de>2022-09-09 20:46:33 +0700
commit0ccd8781b1fc5fbc730918bdeb829f25b249d001 (patch)
tree238d6dc2d8d57dfe98875a8e8b2a52f68c17276c /contrib/systemd
parente9bdd73fdc4d0f8210bbeda71376afa0e2745e50 (diff)
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: I4b7bcd441e5da81c4c5267715675041171a1ce1e
Diffstat (limited to 'contrib/systemd')
-rw-r--r--contrib/systemd/lc15bts-mgr.service2
-rw-r--r--contrib/systemd/oc2gbts-mgr.service2
-rw-r--r--contrib/systemd/osmo-bts-lc15.service2
-rw-r--r--contrib/systemd/osmo-bts-oc2g.service2
-rw-r--r--contrib/systemd/osmo-bts-sysmo.service2
-rw-r--r--contrib/systemd/osmo-bts-trx.service2
-rw-r--r--contrib/systemd/osmo-bts-virtual.service2
-rw-r--r--contrib/systemd/sysmobts-mgr.service2
8 files changed, 16 insertions, 0 deletions
diff --git a/contrib/systemd/lc15bts-mgr.service b/contrib/systemd/lc15bts-mgr.service
index bf788e61..fbdb774c 100644
--- a/contrib/systemd/lc15bts-mgr.service
+++ b/contrib/systemd/lc15bts-mgr.service
@@ -7,6 +7,8 @@ Wants=lc15-sysdev-remap.service
Type=simple
NotifyAccess=all
WatchdogSec=21780s
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
diff --git a/contrib/systemd/oc2gbts-mgr.service b/contrib/systemd/oc2gbts-mgr.service
index ed915b33..78fbccef 100644
--- a/contrib/systemd/oc2gbts-mgr.service
+++ b/contrib/systemd/oc2gbts-mgr.service
@@ -7,6 +7,8 @@ Wants=oc2g-sysdev-remap.service
Type=simple
NotifyAccess=all
WatchdogSec=21780s
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
diff --git a/contrib/systemd/osmo-bts-lc15.service b/contrib/systemd/osmo-bts-lc15.service
index 7c511100..0266c9ad 100644
--- a/contrib/systemd/osmo-bts-lc15.service
+++ b/contrib/systemd/osmo-bts-lc15.service
@@ -4,6 +4,8 @@ Description=osmo-bts for LC15 / sysmoBTS 2100
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-lc15 -t 2 -s -c /etc/osmocom/osmo-bts-lc15.cfg -M
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
RuntimeDirectory=osmo-bts
Restart=always
RestartSec=2
diff --git a/contrib/systemd/osmo-bts-oc2g.service b/contrib/systemd/osmo-bts-oc2g.service
index 860aeb1f..b0b1f7e2 100644
--- a/contrib/systemd/osmo-bts-oc2g.service
+++ b/contrib/systemd/osmo-bts-oc2g.service
@@ -4,6 +4,8 @@ Description=osmo-bts for OC-2G
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-oc2g -s -c /etc/osmocom/osmo-bts-oc2g.cfg -M
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
RuntimeDirectory=osmo-bts
Restart=always
RestartSec=2
diff --git a/contrib/systemd/osmo-bts-sysmo.service b/contrib/systemd/osmo-bts-sysmo.service
index 92558172..f297cfc8 100644
--- a/contrib/systemd/osmo-bts-sysmo.service
+++ b/contrib/systemd/osmo-bts-sysmo.service
@@ -7,6 +7,8 @@ ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
ExecStart=/usr/bin/osmo-bts-sysmo -s -c /etc/osmocom/osmo-bts-sysmo.cfg -M
ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 ; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s'
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
RestartPreventExitStatus=1
diff --git a/contrib/systemd/osmo-bts-trx.service b/contrib/systemd/osmo-bts-trx.service
index 97c2b070..e73e7935 100644
--- a/contrib/systemd/osmo-bts-trx.service
+++ b/contrib/systemd/osmo-bts-trx.service
@@ -4,6 +4,8 @@ Description=Osmocom osmo-bts for osmo-trx
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-trx -s -c /etc/osmocom/osmo-bts-trx.cfg
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
diff --git a/contrib/systemd/osmo-bts-virtual.service b/contrib/systemd/osmo-bts-virtual.service
index 16332669..877181b7 100644
--- a/contrib/systemd/osmo-bts-virtual.service
+++ b/contrib/systemd/osmo-bts-virtual.service
@@ -4,6 +4,8 @@ Description=Osmocom GSM BTS for virtual Um layer based on GSMTAP/UDP
[Service]
Type=simple
ExecStart=/usr/bin/osmo-bts-virtual -s -c /etc/osmocom/osmo-bts-virtual.cfg
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2
diff --git a/contrib/systemd/sysmobts-mgr.service b/contrib/systemd/sysmobts-mgr.service
index 4346991d..c9cbabac 100644
--- a/contrib/systemd/sysmobts-mgr.service
+++ b/contrib/systemd/sysmobts-mgr.service
@@ -4,6 +4,8 @@ Description=osmo-bts manager for sysmoBTS
[Service]
Type=simple
ExecStart=/usr/bin/sysmobts-mgr -ns -c /etc/osmocom/sysmobts-mgr.cfg
+StateDirectory=osmocom
+WorkingDirectory=%S/osmocom
Restart=always
RestartSec=2