supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Jan Braun <janbraun@gmx.de>
To: Paul Sopka <psopka@sopka.ch>
Cc: supervision@list.skarnet.org
Subject: Re: s6/s6-rc policy for Gentoo: config files for service scripts
Date: Thu, 19 Sep 2024 05:33:16 +0200	[thread overview]
Message-ID: <ZuubfBIDY8YNviIZ@abakus> (raw)
In-Reply-To: <442f0112-3120-4609-8a87-c4d9f7119868@sopka.ch>

[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]

Paul Sopka schrob:
> - The sysadmin or the user can copy a skeleton from
> /etc/s6-rc/skel/{config,src} (which is populated by the package
> manager with configs and initial bundles) to ${HOME}/.config/s6-rc/,
> this folder shall be used for configuration and custom user services.

A skeleton is not config data, and should thus be in /usr/
Possibly /usr/.../examples/...

> - The package manager puts service source directories and an initial
> set of bundles for system services to
> /etc/s6-rc/system/src/{services,bundles}.
> 
> - The package manager puts service source directories and an initial
> set of bundles for both user and system services to
> /usr/share/s6-rc/{user,system} as a reference of the defaults.

If you put defaults in /usr, then prefer symlinking them into /etc,
rather than creating a copy. That'll automatically handle changing
defaults, and make it obvious what is locally customized.


> - The idea of config files is completely dropped and the "editing the
> config" part is shifted to "editing the run-script"
> [...]
> Do you suggest any alterations or even a completely different approach?

Void has a nice idiom in their run scripts:

| #!/bin/sh
| exec 2>&1
| [ -r conf ] && . ./conf
| exec acpid -f ${OPTS:=-l}

That achieves 3 things:
1) It works out of the box (without a conf file).
2) The user can create a conf file containing
        OPTS='-l -d -S'
   to customize the daemon options.
3) The user can create a conf file containing
        if [ $((`date +%s` % 100)) -eq 0 ] ; then poweroff ; fi
        exec /usr/local/bin/notreallyacpid --foo
   to completely¹ override the run file.

Note how the KEY=value pair in 2) is actually shell, hopefully
eliminating any worries about config file format.

HTH,
    Jan

¹)
The "exec 2>&1" is an artifact of how runit does logging, and should
always be done. Hence it comes before the conf entry point. If there was
a valid use for stderr, lines 2 and 3 could be switched, of course.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-09-19  3:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18 19:43 Paul Sopka
2024-09-19  3:33 ` Jan Braun [this message]
2024-09-19 14:40   ` Paul Sopka
2024-09-19 17:51     ` Jan Braun
2024-09-19 18:28       ` Hoël Bézier
2024-09-19 19:11         ` Paul Sopka
2024-09-19 20:26           ` Jan Braun
2024-09-20 10:19             ` Paul Sopka
2024-09-20 11:10               ` Jan Braun
2024-09-19 19:07       ` Paul Sopka
2024-09-19 20:47         ` Re[2]: " Laurent Bercot
2024-09-20 10:21           ` 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=ZuubfBIDY8YNviIZ@abakus \
    --to=janbraun@gmx.de \
    --cc=psopka@sopka.ch \
    --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).