Replace 'initctl emit <EV>' with 'initctl cond <cmd> <COND>'

This patch replaces the old 'initctl emit <EV>' idea with a more
full blown condition generator:

    initctl cond <set|clear|flux> <COND>

This aligns better with terminology used elsewhere in the new Finit
service state machine and dependency handling already documented.

The 'flux' sub-command is mostly intended for simulation/test of
Finit itself and should perhaps not be documented.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-07-15 15:51:57 +02:00
parent 2b74fb0e93
commit c7573fedad
3 changed files with 60 additions and 68 deletions
+15 -3
View File
@@ -40,14 +40,14 @@ service's pidfile being created.
Triggering
----------
Conditions are triggered either by plugins or by using the `emit`
Conditions are triggered either by plugins or by using the `cond`
command of the `initctl` control tool.
* `initctl emit +your/cond/here`
* `initctl cond set your/cond/here`
To set a condition
* `initctl emit -your/cond/here`
* `initctl cond clear your/cond/here`
To clear a condition
@@ -115,6 +115,18 @@ are in the `on` state, as indicated by the `+`-prefix. `udhcpc` however
is not allowed to run since `net/vlan1/exist` condition is not satsifed.
As indicated by the `-`-prefix.
To fake interface `vlan1` suddenly appearing, and test what happens to
`udhcpc` we can enable debug mode and assert the condition, like this:
```shell
~ # initctl debug
~ # initctl cond set net/vlan1/exist
```
Then watch the console for the debug messages and then check the output
from `initctl cond show` again. (The client will likely have failed to
start, but at least the condition is now satisfied.)
Internals
---------