On Tue, Sep 16, 2025 at 11:32:33AM -0400, Steve Litt wrote:
> aitor said on Tue, 16 Sep 2025 16:47:04 +0200
>
> >https://specifications.freedesktop.org/basedir-spec/latest
> >
> >According to the specifications:
> >
> >"There is a single base directory relative to which
> > user-specific runtime files and other file objects should
> > be placed. This directory is defined by the environment
> > variable|$XDG_RUNTIME_DIR"|
>
> Thanks Aitor!
>
> I just echoed XDG_RUNTIME_DIR on my Void Linux machine and got no
> output. So $XDG_RUNTIME_DIR might be a great alternative for
> freedesktopy distros, but it's not universal.
I'm also for the freedesktop spec to use, but it works in a bit
different way:
- XDG_RUNTIME_DIR is a wrong place for logs - as it was already
mentioned in other replies it's not suitable for persistent files and
usually located on tmpfs.
- The right place for logs is XDG_STATE_HOME.
- If $XDG_STATE_HOME is unset on your system that's absolutely fine,
it just means default value should be used: $HOME/.local/state/.
I use $XDG_CONFIG_HOME/runsvdir/current/$SERVICE/ for service directories
(e.g. ~/.config/runsvdir/current/docker/ to run rootless docker daemon) and
$XDG_STATE_HOME/runsvdir/$SERVICE/ for logs (e.g. ~/.local/state/runsvdir/docker/).
Arguably it might be $XDG_STATE_HOME/log/$SERVICE/ instead.
The "current" is a symlink managed in same way as `runsvchdir` does -
so user can use different groups of services in ~/.config/runsvdir/*/
just like OS runlevels in /etc/runit/runsvdir/*/.
--
WBR, Alex.
Received on Thu Sep 18 2025 - 08:31:46 CEST