Project

General

Profile

Feature #12509

Want SMF syntax to auto-create runtime directories

Added by Alexander Pyhalov 6 months ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Category:
smf
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

systemd units support several options, controlling runtime directories creation.
At least, RuntimeDirectory analog would be extremely useful (especially with read-only /var/run). Now we have a lot of services, wrapped in 'mkdir and su application user' scripts to fix this issue.

From systemd documentation: https://www.freedesktop.org/software/systemd/man/systemd.exec.html

RuntimeDirectory=, StateDirectory=, CacheDirectory=, LogsDirectory=, ConfigurationDirectory=

    These options take a whitespace-separated list of directory names. The specified directory names must be relative, and may not include "..". If set, one or more directories by the specified names will be created (including their parents) below the locations defined in the following table, when the unit is started. Also, the corresponding environment variable is defined with the full path of directories. If multiple directories are set, then in the environment variable the paths are concatenated with colon (":").
...
In case of RuntimeDirectory= the innermost subdirectories are removed when the unit is stopped. It is possible to preserve the specified directories in this case if RuntimeDirectoryPreserve= is configured to restart or yes (see below). The directories specified with StateDirectory=, CacheDirectory=, LogsDirectory=, ConfigurationDirectory= are not removed when the unit is stopped.

History

#1

Updated by Robert Mustacchi 5 months ago

  • Assignee set to Robert Mustacchi
  • Category set to smf

Also available in: Atom PDF