From: Paul Sopka <psopka@sopka.ch>
To: Laurent Bercot <ska-supervision@skarnet.org>,
supervision@list.skarnet.org
Subject: Re: s6/s6-rc policy for Gentoo: The logging directory
Date: Sat, 6 Jul 2024 15:28:24 +0200 [thread overview]
Message-ID: <1187fbb7-1c76-4ff2-8e65-dfa1b6914752@sopka.ch> (raw)
In-Reply-To: <em9090ef7d-fe7f-479d-bb32-3f7998f6ac53@ceb3c058.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 2823 bytes --]
> Any environment variable you want to make available for a whole
> supervision tree should be added via a "-e var=value" option to your
> s6-linux-init-maker invocation.
Thanks, will do!
> For user supervision trees, I suppose you're not using s6-l-i-m, so
> the best place would be to put the variables in an envdir and use
> "-E $envdir" (and possibly "-e $var" if you need to substitute $USER
> or something) in your s6-usertree-maker invocation.
> If you're not using these tools, the best way is to do the same thing
> they do: put the variables in an envdir somewhere, and source the envdir
> both before running s6-svscan and before running your s6-rc-init and
> s6-rc script.
I tested s6-usertree-maker, but I does not do everything I need. Anyway,
I based my currently working scripts on its output.
This is how it looks right now:
${USER}-sv/run:
#!/bin/execlineb -P
fdmove -c 2 1
define USER Nanderty
define XDG_RUNTIME_DIR /run/${USER}
emptyenv -p
export USER ${USER}
s6-envuidgid -i ${USER}
backtick -in HOME { homeof ${USER} }
multisubstitute
{
importas -Si USER
importas -Si HOME
importas -Si UID
importas -Si GID
importas -Si GIDLIST
}
foreground install -d -o ${USER} -g ${USER} -m 700 ${XDG_RUNTIME_DIR} ""
foreground install -d -o ${USER} -g ${USER} /var/log/${USER} ""
foreground install -d -o ${USER} -g ${USER} ${XDG_RUNTIME_DIR}/service ""
export XDG_DATA_HOME ${HOME}/.local/share
export XDG_STATE_HOME ${HOME}/.local/state
export XDG_CACHE_HOME ${HOME}/.cache
export XDG_RUNTIME_DIR ${XDG_RUNTIME_DIR}
export DBUS_SESSION_BUS_ADDRESS unix:path=${XDG_RUNTIME_DIR}/session-bus
s6-applyuidgid -U
s6-svscan -d3 ${XDG_RUNTIME_DIR}/service
${USER}-sv/finish:
#!/bin/execlineb -P
define USER Nanderty
rm -rf /run/${USER}
${USER}-rc/up:
#!/bin/execlineb -P
fdmove -c 2 1
define USER Nanderty
s6-setuidgid ${USER}
foreground {
s6-rc-init -c /home/${USER}/.local/share/s6-rc/compiled -l
/run/${USER}/s6-rc /run/${USER}/service
}
s6-rc -v2 -l /run/${USER}/s6-rc -up change default
${USER}-rc/down:
#!/bin/execlineb -P
define USER Nanderty
s6-setuidgid ${USER}
s6-rc -l /run/${USER}/s6-rc -bDa change
Plus, of course, the catch all logger for the ${USER}-sv process.
I would just export the logging dir variable as I do with the XDG_*
vars, so I do not need to source a variable dir. I would need to define
them in this script anyway, if I do not want to use the env-dir as a
permanent external config file.
Would you consider it a better way to utilize an env-dir as a means of a
config and source it in ${USER}-sv/run, thus exporting the vars for all
child processes anyway?
Thank you for your input.
Paul
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2024-07-06 13:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 23:45 Paul Sopka
2024-07-06 10:06 ` Laurent Bercot
2024-07-06 13:28 ` Paul Sopka [this message]
[not found] ` <ZoqyuyVTk4fBYm3s@sparta>
2024-07-07 15:46 ` Paul Sopka
2024-07-08 22:45 ` Peter Pentchev
2024-07-09 0:03 ` Jan Braun
2024-07-09 8:24 ` Paul Sopka
2024-07-12 13:15 ` Carlos Eduardo
2024-07-13 10:04 ` Paul Sopka
2024-07-14 15:25 ` Jan Braun
2024-07-14 20:57 ` Paul Sopka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1187fbb7-1c76-4ff2-8e65-dfa1b6914752@sopka.ch \
--to=psopka@sopka.ch \
--cc=ska-supervision@skarnet.org \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).