mirror of
https://github.com/troglobit/finit.git
synced 2026-11-17 19:30:29 +00:00
service: add stop-scope, which processes a stop applies to
When the main process of a service exits, Finit sends SIGKILL to its
process group. That killed the action script of avahi-autoipd, which
it runs on SIGTERM to deconfigure the interface, before it was done.
Add stop-scope, in the block format and as the stop-scope: token:
service avahi-autoipd {
stop-scope = "process"
command = "avahi-autoipd eth0"
}
- pgroup: the stop signal to the main process, SIGKILL to its
process group when it exits, as before and the default
- process: only the main process
- cgroup: the stop signal to all of the cgroup, SIGKILL to the rest
- mixed: the stop signal to the main process, SIGKILL to the rest of
the cgroup, like systemd's KillMode=mixed
SIGKILL to a cgroup uses cgroup.kill when the kernel has it. Without
a cgroup, cgroup and mixed fall back to the process group. Services
in the same .conf file share a cgroup, Finit warns when one of them
uses a cgroup scope.
Fixes #413
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
11 files changed
+274
-16
No files matched your search
@@ -69,6 +69,7 @@ Service options
|
||||
| `oncrash:reboot` | `oncrash = "reboot"` |
|
||||
| `halt:SIG` | `stop-signal = "SIG"` |
|
||||
| `kill:SEC` | `stop-timeout = SEC` |
|
||||
| `stop-scope:SCOPE` | `stop-scope = "SCOPE"` |
|
||||
| `pre:[TMO,]/script` | `exec-start-pre`, `exec-start-pre-timeout` |
|
||||
| `ready:[TMO,]/script` | `exec-start-ready`, and its `-timeout` |
|
||||
| `stop:[TMO,]/script` | `exec-stop`, and its `-timeout` |
|
||||
|
||||
@@ -259,6 +259,27 @@ down gracefully. If it has not been collected within 3 seconds,
|
||||
|
||||
* `stop-signal = "SIGPWR"` -- send this instead of `SIGTERM`
|
||||
* `stop-timeout = 10` -- seconds to wait before `SIGKILL`, 1-300
|
||||
* `stop-scope = "process"` -- which processes are stopped, see below
|
||||
|
||||
The stop signal goes to the main process of the service. When that
|
||||
exits, Finit sends `SIGKILL` to any processes it left behind in its
|
||||
process group. This is the default, `stop-scope = "pgroup"`. Other
|
||||
scopes:
|
||||
|
||||
* `process` -- only the main process, anything it leaves behind is
|
||||
left alone, e.g. a script it started on its way down
|
||||
* `cgroup` -- the stop signal goes to all processes in the cgroup of
|
||||
the service, and `SIGKILL` to those still there when the main
|
||||
process exits
|
||||
* `mixed` -- the stop signal goes to the main process, and `SIGKILL`
|
||||
to the rest of the cgroup when it exits
|
||||
|
||||
All services declared in the same .conf file share a cgroup, unless
|
||||
given a [name of their own](cgroups.md#overriding-cgroup-leaf-names),
|
||||
so `cgroup` and `mixed` reach them all, Finit warns about this. Without
|
||||
cgroups, these two fall back to the process group. A forking daemon
|
||||
usually leaves the process group of its start command, so only `cgroup`
|
||||
and `mixed` reach what it leaves behind.
|
||||
|
||||
Some services need more than a signal:
|
||||
|
||||
|
||||
Reference in new issue
Block a user