service: make killmode=cgroup|mixed, SendSIGKILL=no services singletons

KillMode=mixed and control group are used to indicate that all
process should be killed off. SendSIGKILL is used for services
that require a clean shutdown. These are typically database
service where a SigKilled process would result in a lengthy
recovery and who's shutdown or startup time is quite variable
(so Timeout settings aren't of use).

Here we take these two factors and refuse to start a service if
there are existing processes within a control group. Databases,
while generally having some protection against multiple instances
running, lets not stress the rigor of these. Also ExecStartPre
parts of the service aren't as rigoriously written to protect
against against multiple use.

closes #8630
This commit is contained in:
Daniel Black
2019-01-29 15:35:59 +11:00
parent 61a38e0265
commit c53d2d54bd
6 changed files with 52 additions and 17 deletions
+5 -2
View File
@@ -139,8 +139,11 @@
<constant>SIGKILL</constant> (or the signal specified by
<varname>FinalKillSignal=</varname>) to remaining processes
after a timeout, if the normal shutdown procedure left
processes of the service around. Takes a boolean value.
Defaults to "yes".
processes of the service around. When disabled, a
<varname>KillMode=</varname> of <constant>control-group</constant>
or <constant>mixed</constant> service will not restart if
processes from prior services exist within the control group.
Takes a boolean value. Defaults to "yes".
</para></listitem>
</varlistentry>