From 6149e93aca8614690f512da0663b3393fbf6e9ff Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Fri, 28 Feb 2020 17:16:24 +0100 Subject: [PATCH] docs: Update documentation on svc conditions Signed-off-by: Joachim Nilsson --- docs/conditions.md | 19 +++++++++++++++++++ docs/config.md | 16 ++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/docs/conditions.md b/docs/conditions.md index 7722cfbf..f6f1b6ba 100644 --- a/docs/conditions.md +++ b/docs/conditions.md @@ -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 --------- diff --git a/docs/config.md b/docs/config.md index 427c2a38..ee03b921 100644 --- a/docs/config.md +++ b/docs/config.md @@ -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 ``. + 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 ``, 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