mirror of
https://github.com/troglobit/finit.git
synced 2026-10-16 10:39:35 +00:00
Major change, rename <svc/...> conditions to <pid/...> conditions
The <svc/foo> condition was created to synchronize starting services, hence the abbreviation. Example: the Quagga ripd needs to start after the zebra daemon to ensure its UNIX domain socket is active, otherwise events may be lost. However, considering that synchronization was implemented with UNIX PID files, e.g. waiting for /var/run/quagga/zebra.pid to be created, the condition abbreviation name <svc/foo> was hard to understand by most newcomers to Finit. To make matters worse, a new feature to track or even create PID files for services that don't create one themselves, using the syntax 'pid:/path/to/foo.pid' was added. Connecting the dots between these wasn't obvious. This patch renames service conditions pid conditions and also adds a compatibility wrapper to the Finit .conf parser. Any condition given in old .conf files with 'svc/' prefix are internally renamed 'pid/', along with a LOG_INFO notice in syslog. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
ff41868b59
commit
a8b113185d
15 files changed
+43
-36
No files matched your search
+10
-10
@@ -31,11 +31,11 @@ service to run.
|
||||
### Example
|
||||
|
||||
```shell
|
||||
service [2345] <svc/sbin/setupd,svc/sbin/zebra> /sbin/netd -- Network monitor
|
||||
service [2345] <pid/sbin/setupd,pid/sbin/zebra> /sbin/netd -- Network monitor
|
||||
```
|
||||
|
||||
In this example the Network monitor daemon `netd` is not started until
|
||||
both the `svc/sbin/setupd` *and* `svc/sbin/zebra` conditions are
|
||||
both the `pid/sbin/setupd` *and* `pid/sbin/zebra` conditions are
|
||||
satisfied. An `svc` condition is satisfied by the corresponding
|
||||
service's PID file being created.
|
||||
|
||||
@@ -62,7 +62,7 @@ Built-in Conditions
|
||||
|
||||
Finit is distributed with a `pidfile` and `netlink` plugin. If enabled,
|
||||
the `pidfile` plugin watches `/var/run/` for PID files created by the
|
||||
monitored services, and sets a corresponding condition in the `svc/`
|
||||
monitored services, and sets a corresponding condition in the `pid/`
|
||||
namespace. Similarily, the `netlink` plugin provides basic conditions
|
||||
for when an interface is brought up/down and when a default route
|
||||
(gateway) is set, in the `net/` namespace.
|
||||
@@ -81,7 +81,7 @@ file touched (re-created).
|
||||
|
||||
Built-in conditions:
|
||||
|
||||
- `svc/<PATH>`
|
||||
- `pid/<PATH>`
|
||||
- `net/route/default`
|
||||
- `net/<IFNAME>/exist`
|
||||
- `net/<IFNAME>/up`
|
||||
@@ -95,16 +95,16 @@ Built-in conditions:
|
||||
Composition
|
||||
-----------
|
||||
|
||||
The `svc/` conditions can be quite tricky to understand. They are
|
||||
The `pid/` 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 |
|
||||
| /sbin/foo | | /run/foo.pid | pid/sbin/foo |
|
||||
| /sbin/bar -p /run/baz.pid | pid:baz | /run/bas.pid | pid/sbin/baz |
|
||||
| lxc-start -n foo -p /run/lxc/foo.pid | pid:lxc/foo.pid | /run/lxc/foo.pid | pid/lxc/foo |
|
||||
| /usr/bin/dbus-daemon | pid:dbus/pid | /run/dbus/pid | pid/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
|
||||
@@ -128,7 +128,7 @@ conditions that are not satisfied. Listed as `off` below.
|
||||
~ # initctl cond show
|
||||
PID Service Status Condition (+ on, ~ flux, - off)
|
||||
===============================================================================
|
||||
1419 /sbin/netd on <+svc/sbin/setupd,+svc/sbin/zebra>
|
||||
1419 /sbin/netd on <+pid/sbin/setupd,+pid/sbin/zebra>
|
||||
0 /sbin/udhcpc off <-net/vlan1/exist>
|
||||
```
|
||||
|
||||
|
||||
+2
-2
@@ -184,7 +184,7 @@ Syntax
|
||||
from forking (daemonizing):
|
||||
|
||||
```shell
|
||||
service [2345] <svc/sbin/zebra> /sbin/ospfd -- OSPF daemon
|
||||
service [2345] <pid/sbin/zebra> /sbin/ospfd -- OSPF daemon
|
||||
```
|
||||
|
||||
The `[2345]` is the runlevels `ospfd` is allowed to run in, they are
|
||||
@@ -206,7 +206,7 @@ Syntax
|
||||
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.
|
||||
can depend on `<pid/sbin/foo>`, notice the composition of conditions.
|
||||
|
||||
However, if a service `bar` *does* create a PID file, using `foo.pid`,
|
||||
we can inform Finit of this by prepending an `!`:
|
||||
|
||||
Reference in new issue
Block a user