Re: Configuration and scripts location

From: Casper Ti. Vector <>
Date: Thu, 23 Feb 2017 00:52:52 +0800

If you differentiate between instances by using a naming convention like
`service.instance', you can let the `run'/`finish' scripts defer the
paths to instance-specific config files/directories. In this way, you
can orthogonalise service configs from service definitions, and have
instanced supervision at the same time.

For example, I put configs for different openvpn instances in
`/etc/openvpn', like `/etc/openvpn/sth.conf' (main config file for the
`sth' instance) and `/etc/openvpn/sth/' (auxillary config files for
`sth', referenced in `/etc/openvpn/sth.conf' by absolute paths), and
write the `run' template as
> #!/bin/rc -e
> exec >[2=1]
> . /etc/s6-rc/bin/fn.rc
> exec emptyenv -p openvpn /etc/openvpn/$name.conf
(BTW, I found the `getty' template I posted in another thread to lack an
`emptyenv -p'; it is fixed on my machines now.)

Helper scripts are just a subset of configuration files, so the solution
above applies as well.

On Wed, Feb 22, 2017 at 11:18:10AM +0100, Guillaume Perréal wrote:
> For longruns, one could either put the in the data/ and env/
> subdirectories, or in a /etc subdirectory. The former allows to easily
> have different instances of the same services but the files might be
> harder to locate, and requires to update the s6-rc database to change
> the configuration. The latter allows to use a well-known location and to
> update the configuration without updating the s6-rc database.
> The same question goes for helper scripts (for example, the "event
> handler" of udhcpc, responsible for applying the configuration). I'm
> torn between putting them in s6-rc/scripts/the-service-that-uses-them, a
> "scripts" subdirectory in their configuration, or something like
> {/lib,/usr/share}/the-service-that-uses-them. Moreover, considering that
> the service scripts are moved around, use of absolute paths is required.

My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C
Received on Wed Feb 22 2017 - 16:52:52 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC