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: I7696cd92953787591e7b4777ee79c2671326b972
This commit is contained in:
Max 2022-08-30 19:45:32 +07:00
parent 5892b2e4db
commit 709aad28ed
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,8 @@ Description=Osmocom Media Gateway (MGW)
[Service]
Type=simple
StateDirectory=osmocom
WorkingDirectory=%S/osmocom
Restart=always
ExecStart=/usr/bin/osmo-mgw -s -c /etc/osmocom/osmo-mgw.cfg
RestartSec=2