diff --git a/README.md b/README.md index 8f611c0c..d4a30dfc 100644 --- a/README.md +++ b/README.md @@ -525,7 +525,7 @@ receives a pointer to the `svc_t` of the service, with all command line parameters free to modify as needed. All the callback needs to do is respond with one of: `SVC_STOP (0)` -tells finit to *not* start the service, `SVC_START (1)` to start the +tells Finit to *not* start the service, `SVC_START (1)` to start the service, or `SVC_RELOAD (2)` to have finit signal the process with `SIGHUP`. @@ -534,10 +534,9 @@ Rebooting & Halting ------------------- Finit handles `SIGUSR1` and `SIGUSR2` for reboot and halt, and listens -to `/dev/initctl` so system reboot and halt commands also work. This -latter functionality is implemented in the optional `initctl.so` plugin -and can be accessed with the `telinit` command line tool, symlinked to -`finit`). +to `/dev/initctl` so system reboot and halt commands also work. The +latter is implemented in the optional `initctl.so` plugin and can be +accessed with the `telinit` command line tool, symlinked to `finit`. ~ # telinit Usage: telinit [OPTIONS] [q | Q | 0-9] @@ -557,20 +556,49 @@ services, called `initctl`. Usage: initctl [OPTIONS] Options: + -a, --activate Activate changes, only with 'reload' -v, --verbose Verbose output -h, --help This help text Commands: + update | prepare debug Toggle Finit debug - reload Reload *.conf in /etc/finit.d/ + emit Emit an event, EV: can be one of STOP, + START, GW, IFUP:IFNAME, IFDN:IFNAME, where + IFNAME is the interface name, e.g. eth0 + reload [-a] Reload *.conf in /etc/finit.d/ runlevel <0-9> Change runlevel: 0 halt, 6 reboot status Show status of services - start Start stopped service - stop Stop running service - restart Restart (stop/start) running service - reload Reload (SIGHUP) running service + start Start stopped service + stop Stop running service + restart Restart (stop/start) running service + reload Reload (SIGHUP) running service version Show Finit version +The `emit ` command can be used to send events to Finit. Built-in +events are: RELOAD, STOP, START. These events act on a lower level than +their command counterparts. The `reload` command reloads all `*.conf` +files *and* activates the changes, with `emit RELOAD` only the `*.conf` +files are reloaded. To simulate the `reload` command all three events +need to be emitted, in order: `emit RELOAD`, `emit STOP`, `emit START`. +In practise this can be used to load a complete system configuration, +and between `STOP` and `START` reset/change any hardware or kernel +settings required to be in effect before new services are started. + +The `emit ` command can also be used to emit custom events. In +fact, the event is a simple string. Declare a list of events in a +service stanza: `service ... ` to reload (`SIGHUP`) a +service when recieving the `"GW"` or `"IFUP:eth0"` strings. If a +service cannot handle reload and must be stopped-started, simply add an +exclamation mark first: `service ... `. + +The `` notation to a service stanza can be use empty then it will +apply to `reload` and `runlevel` commands. I.e., when a service's .conf +file has been changed Finit will stop and start a service marked with +``. If a service does *not* have `` declared, then the `STOP` +phase is postponed and the service is reloaded (`SIGHUP`:ed) in the +`START` phase instead. + Remember, you can only start/stop services that match the current runlevel. Hence, if the runlevel is 2, the below Dropbear SSH service cannot be started.