]>
Commit | Line | Data |
---|---|---|
4819ff03 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
4819ff03 | 5 | |
4623eecb | 6 | <refentry id="systemd.kill" xmlns:xi="http://www.w3.org/2001/XInclude"> |
798d3a52 ZJS |
7 | <refentryinfo> |
8 | <title>systemd.kill</title> | |
9 | <productname>systemd</productname> | |
798d3a52 ZJS |
10 | </refentryinfo> |
11 | ||
12 | <refmeta> | |
13 | <refentrytitle>systemd.kill</refentrytitle> | |
14 | <manvolnum>5</manvolnum> | |
15 | </refmeta> | |
16 | ||
17 | <refnamediv> | |
18 | <refname>systemd.kill</refname> | |
19 | <refpurpose>Process killing procedure | |
20 | configuration</refpurpose> | |
21 | </refnamediv> | |
22 | ||
23 | <refsynopsisdiv> | |
24 | <para><filename><replaceable>service</replaceable>.service</filename>, | |
25 | <filename><replaceable>socket</replaceable>.socket</filename>, | |
26 | <filename><replaceable>mount</replaceable>.mount</filename>, | |
27 | <filename><replaceable>swap</replaceable>.swap</filename>, | |
28 | <filename><replaceable>scope</replaceable>.scope</filename></para> | |
29 | </refsynopsisdiv> | |
30 | ||
31 | <refsect1> | |
32 | <title>Description</title> | |
33 | ||
34 | <para>Unit configuration files for services, sockets, mount | |
35 | points, swap devices and scopes share a subset of configuration | |
36 | options which define the killing procedure of processes belonging | |
37 | to the unit.</para> | |
38 | ||
39 | <para>This man page lists the configuration options shared by | |
40 | these five unit types. See | |
41 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
42 | for the common options shared by all unit configuration files, and | |
43 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
44 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
45 | <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
46 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
47 | and | |
48 | <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
49 | for more information on the configuration file options specific to | |
50 | each unit type.</para> | |
51 | ||
52 | <para>The kill procedure configuration options are configured in | |
53 | the [Service], [Socket], [Mount] or [Swap] section, depending on | |
54 | the unit type.</para> | |
55 | </refsect1> | |
56 | ||
57 | <refsect1> | |
58 | <title>Options</title> | |
59 | ||
60 | <variablelist class='unit-directives'> | |
61 | ||
62 | <varlistentry> | |
63 | <term><varname>KillMode=</varname></term> | |
9b52e0d8 LP |
64 | <listitem><para>Specifies how processes of this unit shall be killed. One of |
65 | <option>control-group</option>, <option>mixed</option>, <option>process</option>, | |
798d3a52 ZJS |
66 | <option>none</option>.</para> |
67 | ||
9b52e0d8 LP |
68 | <para>If set to <option>control-group</option>, all remaining processes in the control group of this |
69 | unit will be killed on unit stop (for services: after the stop command is executed, as configured | |
70 | with <varname>ExecStop=</varname>). If set to <option>mixed</option>, the | |
71 | <constant>SIGTERM</constant> signal (see below) is sent to the main process while the subsequent | |
72 | <constant>SIGKILL</constant> signal (see below) is sent to all remaining processes of the unit's | |
73 | control group. If set to <option>process</option>, only the main process itself is killed (not | |
74 | recommended!). If set to <option>none</option>, no process is killed (strongly recommended | |
75 | against!). In this case, only the stop command will be executed on unit stop, but no process will be | |
76 | killed otherwise. Processes remaining alive after stop are left in their control group and the | |
77 | control group continues to exist after stop unless empty.</para> | |
78 | ||
79 | <para>Note that it is not recommended to set <varname>KillMode=</varname> to | |
80 | <constant>process</constant> or even <constant>none</constant>, as this allows processes to escape | |
81 | the service manager's lifecycle and resource management, and to remain running even while their | |
82 | service is considered stopped and is assumed to not consume any resources.</para> | |
798d3a52 | 83 | |
2e34d21b | 84 | <para>Processes will first be terminated via <constant>SIGTERM</constant> (unless the signal to send |
b557f1c1 ZJS |
85 | is changed via <varname>KillSignal=</varname> or <varname>RestartKillSignal=</varname>). Optionally, |
86 | this is immediately followed by a <constant>SIGHUP</constant> (if enabled with | |
f63e259b CBI |
87 | <varname>SendSIGHUP=</varname>). If processes still remain after: |
88 | <itemizedlist> | |
89 | <listitem><para>the main process of a unit has exited (applies to <varname>KillMode=</varname>: | |
90 | <option>mixed</option>)</para></listitem> | |
91 | <listitem><para>the delay configured via the <varname>TimeoutStopSec=</varname> has passed | |
92 | (applies to <varname>KillMode=</varname>: <option>control-group</option>, <option>mixed</option>, | |
93 | <option>process</option>)</para></listitem> | |
94 | </itemizedlist> | |
95 | ||
96 | the termination request is repeated with the <constant>SIGKILL</constant> signal or the signal specified via | |
b557f1c1 ZJS |
97 | <varname>FinalKillSignal=</varname> (unless this is disabled via the <varname>SendSIGKILL=</varname> |
98 | option). See <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
99 | for more information.</para> | |
2e34d21b LP |
100 | |
101 | <para>Defaults to <option>control-group</option>.</para></listitem> | |
798d3a52 ZJS |
102 | </varlistentry> |
103 | ||
104 | <varlistentry> | |
105 | <term><varname>KillSignal=</varname></term> | |
b557f1c1 ZJS |
106 | <listitem><para>Specifies which signal to use when stopping a service. This controls the signal that |
107 | is sent as first step of shutting down a unit (see above), and is usually followed by | |
108 | <constant>SIGKILL</constant> (see above and below). For a list of valid signals, see | |
3ba3a79d | 109 | <citerefentry project='man-pages'><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry>. |
b557f1c1 | 110 | Defaults to <constant>SIGTERM</constant>.</para> |
e8c53936 | 111 | |
b557f1c1 ZJS |
112 | <para>Note that, right after sending the signal specified in this setting, systemd will always send |
113 | <constant>SIGCONT</constant>, to ensure that even suspended tasks can be terminated cleanly.</para> | |
114 | </listitem> | |
115 | </varlistentry> | |
116 | ||
117 | <varlistentry> | |
118 | <term><varname>RestartKillSignal=</varname></term> | |
119 | <listitem><para>Specifies which signal to use when restarting a service. The same as | |
120 | <varname>KillSignal=</varname> described above, with the exception that this setting is used in a | |
121 | restart job. Not set by default, and the value of <varname>KillSignal=</varname> is used.</para> | |
e8c53936 | 122 | </listitem> |
798d3a52 ZJS |
123 | </varlistentry> |
124 | ||
125 | <varlistentry> | |
126 | <term><varname>SendSIGHUP=</varname></term> | |
127 | <listitem><para>Specifies whether to send | |
128 | <constant>SIGHUP</constant> to remaining processes immediately | |
129 | after sending the signal configured with | |
130 | <varname>KillSignal=</varname>. This is useful to indicate to | |
131 | shells and shell-like programs that their connection has been | |
132 | severed. Takes a boolean value. Defaults to "no". | |
133 | </para></listitem> | |
134 | </varlistentry> | |
135 | ||
136 | <varlistentry> | |
137 | <term><varname>SendSIGKILL=</varname></term> | |
138 | <listitem><para>Specifies whether to send | |
fbb48d4c JR |
139 | <constant>SIGKILL</constant> (or the signal specified by |
140 | <varname>FinalKillSignal=</varname>) to remaining processes | |
141 | after a timeout, if the normal shutdown procedure left | |
c53d2d54 DB |
142 | processes of the service around. When disabled, a |
143 | <varname>KillMode=</varname> of <constant>control-group</constant> | |
144 | or <constant>mixed</constant> service will not restart if | |
145 | processes from prior services exist within the control group. | |
146 | Takes a boolean value. Defaults to "yes". | |
fbb48d4c JR |
147 | </para></listitem> |
148 | </varlistentry> | |
149 | ||
150 | <varlistentry> | |
151 | <term><varname>FinalKillSignal=</varname></term> | |
152 | <listitem><para>Specifies which signal to send to remaining | |
153 | processes after a timeout if <varname>SendSIGKILL=</varname> | |
154 | is enabled. The signal configured here should be one that is | |
155 | not typically caught and processed by services (<constant>SIGTERM</constant> | |
156 | is not suitable). Developers can find it useful to use this to | |
157 | generate a coredump to troubleshoot why a service did not | |
158 | terminate upon receiving the initial <constant>SIGTERM</constant> | |
159 | signal. This can be achieved by configuring <varname>LimitCORE=</varname> | |
160 | and setting <varname>FinalKillSignal=</varname> to either | |
e9dd6984 | 161 | <constant>SIGQUIT</constant> or <constant>SIGABRT</constant>. |
fbb48d4c | 162 | Defaults to <constant>SIGKILL</constant>. |
798d3a52 ZJS |
163 | </para></listitem> |
164 | </varlistentry> | |
165 | ||
c87700a1 AZ |
166 | <varlistentry> |
167 | <term><varname>WatchdogSignal=</varname></term> | |
168 | <listitem><para>Specifies which signal to use to terminate the | |
169 | service when the watchdog timeout expires (enabled through | |
170 | <varname>WatchdogSec=</varname>). Defaults to <constant>SIGABRT</constant>. | |
171 | </para></listitem> | |
172 | </varlistentry> | |
173 | ||
798d3a52 ZJS |
174 | </variablelist> |
175 | </refsect1> | |
176 | ||
177 | <refsect1> | |
178 | <title>See Also</title> | |
179 | <para> | |
180 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
181 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
68d838f7 | 182 | <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
798d3a52 ZJS |
183 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
184 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
185 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
186 | <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
187 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
188 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
189 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
190 | <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry>, | |
3ba3a79d | 191 | <citerefentry project='man-pages'><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
798d3a52 ZJS |
192 | </para> |
193 | </refsect1> | |
4819ff03 LP |
194 | |
195 | </refentry> |