mirror of
https://github.com/troglobit/finit.git
synced 2026-10-18 10:59:34 +00:00
The syntax overview no longer describes a line-based format, since that is not what the rest of the documentation shows. It now covers the grammar, the two naming conventions, the nine aliases, and the leading '-' on a path, and it says plainly that both formats are still read and told apart per file by content. Without that, a reader with an existing configuration is left wondering what happened to it. service-opts.md was a list of modifiers to place between a directive and its command, so it needed rewriting rather than translating: there are no positions left to describe. It is now grouped by what the settings do. conditions.md needed correcting. It presented '!' as a condition prefix alongside '~'. It is neither a condition nor a negation, it is a flag on the block that means one thing on a service and another on a run or task, so it is spelled reload-signal and required here, and the page maps the old form to both. Two things the pages claimed are not true. The kill delay range is 1-300, not 1-60, and stop and reload scripts are no longer run without a timeout. ChangeLog.md keeps its line-based examples. Those sit in historical release entries, and rewriting them in a syntax that did not exist at the time would misdate the format. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
35 lines
1.2 KiB
Markdown
35 lines
1.2 KiB
Markdown
Service Environment
|
|
-------------------
|
|
|
|
Finit supports sourcing environment variables from `/etc/default/*`, or
|
|
similar `--with-sysconfig=DIR`. This is a common pattern from SysV init
|
|
scripts, where the start-stop script is a generic script for the given
|
|
service, `foo`, and the options for the service are sourced from the
|
|
file `/etc/default/foo`. Like this:
|
|
|
|
* `/etc/default/foo`:
|
|
|
|
FOO_OPTIONS=--extra-arg="bar" -s -x
|
|
|
|
* `/etc/finit.conf`:
|
|
|
|
service foo {
|
|
description = "Example foo daemon"
|
|
runlevel = "2345"
|
|
envfile = "-/etc/default/foo"
|
|
command = "foo -n $FOO_OPTIONS"
|
|
}
|
|
|
|
Here the service `foo` is started with `-n`, to make sure it runs in the
|
|
foreground, and the with the options found in the environment file. With
|
|
the `ps` command we can see that the process is started with:
|
|
|
|
foo -n --extra-arg=bar -s -x
|
|
|
|
> [!NOTE]
|
|
> The leading `-` on `envfile` determines if Finit should treat a
|
|
> missing environment file as blocking the start of the service or not.
|
|
> When `-` is used, a missing environment file does *not* block the
|
|
> start. The same mark works on `command`, where it means carry on if
|
|
> the binary is missing.
|