docs: Update documentation on svc conditions

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2020-02-28 17:16:24 +01:00
parent 4e7baa807e
commit 6149e93aca
2 changed files with 27 additions and 8 deletions
+19
View File
@@ -92,6 +92,25 @@ Built-in conditions:
difference is that `running` tells if the NIC has link.
Composition
-----------
The `svc/` conditions can be quite tricky to understand. They are
generated by the Finit `pidfile.so` plugin and are composed from the
daemon's path and the pidfile name (and path).
| **service** | **pid:** | **pidfile path** | **svc condition** |
|--------------------------------------|-----------------|------------------|-------------------|
| /sbin/foo | | /run/foo.pid | svc/sbin/foo |
| /sbin/bar -p /run/baz.pid | pid:baz | /run/bas.pid | svc/sbin/baz |
| lxc-start -n foo -p /run/lxc/foo.pid | pid:lxc/foo.pid | /run/lxc/foo.pid | svc/lxc/foo |
| /usr/bin/dbus-daemon | pid:dbus/pid | /run/dbus/pid | svc/usr/bin/dbus |
Omitting the `pid:` to run/task/service/sysv stanza means Finit will
guess the pidfile path based on `/run/` and the basename(1) of the
program.
Debugging
---------
+8 -8
View File
@@ -203,21 +203,21 @@ Syntax
pid[:[/path/to/]filename[.pid]]
For example, by adding `pid:/run/foo.pid` to the service `bar` that
PID file will, not only be created and removed automatically, but also
be used by the Finit condition subsystem. So another service/run/task
can depend on `<svc/foo>`.
For example, by adding `pid:/run/foo.pid` to the service `/sbin/bar`
that PID file will, not only be created and removed automatically, but
also be used by the Finit condition subsystem. So a service/run/task
can depend on `<svc/sbin/foo>`, notice the composition of conditions.
If a service `bar` *does* maintain a PID file, but using `foo.pid`, we
can inform Finit of this by prepending an `!` to the argument.
However, if a service `bar` *does* create a PID file, using `foo.pid`,
we can inform Finit of this by prepending an `!`:
pid:!/run/foo.pid
Here Finit will *not* create/remove/touch the PID file, only use it
for the condition handling instead of the default PID file name.
For a detailed description of conditions, and how to debug them, see
the [Finit Conditions](conditions.md) document.
> For a detailed description of conditions, and how to debug them, see
> the [Finit Conditions](conditions.md) document.
If a service should not be automatically started, it can be configured
as manual with the optional `manual` argument. The service can then be