]>
Commit | Line | Data |
---|---|---|
d1ab0ca0 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> | |
3 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
4 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
5 | ||
6 | <!-- | |
7 | This file is part of systemd. | |
8 | ||
9 | Copyright 2010 Lennart Poettering | |
10 | ||
11 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
12 | under the terms of the GNU Lesser General Public License as published by |
13 | the Free Software Foundation; either version 2.1 of the License, or | |
d1ab0ca0 LP |
14 | (at your option) any later version. |
15 | ||
16 | systemd is distributed in the hope that it will be useful, but | |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 19 | Lesser General Public License for more details. |
d1ab0ca0 | 20 | |
5430f7f2 | 21 | You should have received a copy of the GNU Lesser General Public License |
d1ab0ca0 LP |
22 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
23 | --> | |
24 | ||
25 | <refentry id="systemd.service"> | |
26 | <refentryinfo> | |
27 | <title>systemd.service</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>Developer</contrib> | |
33 | <firstname>Lennart</firstname> | |
34 | <surname>Poettering</surname> | |
35 | <email>lennart@poettering.net</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>systemd.service</refentrytitle> | |
42 | <manvolnum>5</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>systemd.service</refname> | |
47 | <refpurpose>systemd service configuration files</refpurpose> | |
48 | </refnamediv> | |
49 | ||
50 | <refsynopsisdiv> | |
51 | <para><filename>systemd.service</filename></para> | |
52 | </refsynopsisdiv> | |
53 | ||
54 | <refsect1> | |
55 | <title>Description</title> | |
56 | ||
1f812fea | 57 | <para>A unit configuration file whose name ends in |
65232ea7 LP |
58 | <filename>.service</filename> encodes information |
59 | about a process controlled and supervised by | |
60 | systemd.</para> | |
d1ab0ca0 LP |
61 | |
62 | <para>This man page lists the configuration options | |
63 | specific to this unit type. See | |
64 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
65 | for the common options of all unit configuration | |
0d624a78 | 66 | files. The common configuration items are configured |
62adf224 LP |
67 | in the generic <literal>[Unit]</literal> and |
68 | <literal>[Install]</literal> sections. The service | |
69 | specific configuration options are configured in the | |
70 | <literal>[Service]</literal> section.</para> | |
0d624a78 | 71 | |
ba60f905 LP |
72 | <para>Additional options are listed in |
73 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
74 | which define the execution environment the commands | |
75 | are executed in.</para> | |
62adf224 LP |
76 | |
77 | <para>Unless <varname>DefaultDependencies=</varname> | |
78 | is set to <option>false</option>, service units will | |
79 | implicitly have dependencies of type | |
80 | <varname>Requires=</varname> and | |
81 | <varname>After=</varname> on | |
82 | <filename>basic.target</filename> as well as | |
83 | dependencies of type <varname>Conflicts=</varname> and | |
84 | <varname>Before=</varname> on | |
85 | <filename>shutdown.target</filename>. These ensure | |
86 | that normal service units pull in basic system | |
87 | initialization, and are terminated cleanly prior to | |
88 | system shutdown. Only services involved with early | |
89 | boot or late system shutdown should disable this | |
90 | option.</para> | |
59a3e1bc LP |
91 | |
92 | <para>If a service is requested under a certain name | |
93 | but no unit configuration file is found, systemd looks | |
94 | for a SysV init script by the same name (with the | |
95 | <filename>.service</filename> suffix removed) and | |
96 | dynamically creates a service unit from that | |
97 | script. This is useful for compatibility with | |
98 | SysV.</para> | |
d1ab0ca0 LP |
99 | </refsect1> |
100 | ||
101 | <refsect1> | |
102 | <title>Options</title> | |
103 | ||
62adf224 LP |
104 | <para>Service files must include a |
105 | <literal>[Service]</literal> section, which carries | |
106 | information about the service and the process it | |
107 | supervises. A number of options that may be used in | |
108 | this section are shared with other unit types. These | |
109 | options are documented in | |
0d624a78 | 110 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The |
62adf224 LP |
111 | options specific to the <literal>[Service]</literal> |
112 | section of service units are the following:</para> | |
0d624a78 | 113 | |
d1ab0ca0 LP |
114 | <variablelist> |
115 | <varlistentry> | |
116 | <term><varname>Type=</varname></term> | |
0d624a78 LP |
117 | |
118 | <listitem><para>Configures the process | |
119 | start-up type for this service | |
120 | unit. One of <option>simple</option>, | |
121 | <option>forking</option>, | |
34e9ba66 | 122 | <option>oneshot</option>, |
0d624a78 LP |
123 | <option>dbus</option>, |
124 | <option>notify</option>.</para> | |
125 | ||
126 | <para>If set to | |
127 | <option>simple</option> (the default | |
128 | value) it is expected that the process | |
129 | configured with | |
130 | <varname>ExecStart=</varname> is the | |
131 | main process of the service. In this | |
b1690fe7 LP |
132 | mode, if the process offers |
133 | functionality to other processes on | |
134 | the system its communication channels | |
135 | should be installed before the daemon | |
136 | is started up (e.g. sockets set up by | |
137 | systemd, via socket activation), as | |
138 | systemd will immediately proceed | |
139 | starting follow-up units.</para> | |
0d624a78 LP |
140 | |
141 | <para>If set to | |
142 | <option>forking</option> it is | |
143 | expected that the process configured | |
144 | with <varname>ExecStart=</varname> | |
b1690fe7 LP |
145 | will call <function>fork()</function> |
146 | as part of its start-up. The parent process is | |
147 | expected to exit when start-up is | |
148 | complete and all communication | |
149 | channels set up. The child continues | |
150 | to run as the main daemon | |
151 | process. This is the behaviour of | |
152 | traditional UNIX daemons. If this | |
0d624a78 LP |
153 | setting is used, it is recommended to |
154 | also use the | |
155 | <varname>PIDFile=</varname> option, so | |
156 | that systemd can identify the main | |
157 | process of the daemon. systemd will | |
158 | proceed starting follow-up units as | |
159 | soon as the parent process | |
160 | exits.</para> | |
161 | ||
162 | <para>Behaviour of | |
34e9ba66 | 163 | <option>oneshot</option> is similar |
0d624a78 LP |
164 | to <option>simple</option>, however |
165 | it is expected that the process has to | |
166 | exit before systemd starts follow-up | |
02ee865a | 167 | units. <varname>RemainAfterExit=</varname> |
0d624a78 LP |
168 | is particularly useful for this type |
169 | of service.</para> | |
170 | ||
171 | <para>Behaviour of | |
172 | <option>dbus</option> is similar to | |
62adf224 LP |
173 | <option>simple</option>, however it is |
174 | expected that the daemon acquires a | |
0d624a78 LP |
175 | name on the D-Bus bus, as configured |
176 | by | |
177 | <varname>BusName=</varname>. systemd | |
178 | will proceed starting follow-up units | |
179 | after the D-Bus bus name has been | |
62adf224 | 180 | acquired. Service units with this |
b1690fe7 | 181 | option configured implicitly gain |
62adf224 | 182 | dependencies on the |
177b3ffe | 183 | <filename>dbus.socket</filename> |
62adf224 | 184 | unit.</para> |
0d624a78 LP |
185 | |
186 | <para>Behaviour of | |
187 | <option>notify</option> is similar to | |
188 | <option>simple</option>, however it is | |
189 | expected that the daemon sends a | |
190 | notification message via | |
191 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
192 | or an equivalent call when it finished | |
193 | starting up. systemd will proceed | |
194 | starting follow-up units after this | |
195 | notification message has been sent. If | |
196 | this option is used | |
62adf224 | 197 | <varname>NotifyAccess=</varname> (see |
b1690fe7 | 198 | below) should be set to open access to |
0d624a78 | 199 | the notification socket provided by |
62adf224 | 200 | systemd. If |
02c4ef9c LP |
201 | <varname>NotifyAccess=</varname> is |
202 | not set, it will be implicitly set to | |
62adf224 | 203 | <option>main</option>.</para> |
d1ab0ca0 LP |
204 | </listitem> |
205 | </varlistentry> | |
0d624a78 | 206 | |
d1ab0ca0 | 207 | <varlistentry> |
02ee865a | 208 | <term><varname>RemainAfterExit=</varname></term> |
0d624a78 LP |
209 | |
210 | <listitem><para>Takes a boolean value | |
211 | that specifies whether the service | |
212 | shall be considered active even when | |
213 | all its processes exited. Defaults to | |
214 | <option>no</option>.</para> | |
d1ab0ca0 | 215 | </listitem> |
3185a36b LP |
216 | </varlistentry> |
217 | ||
218 | <varlistentry> | |
219 | <term><varname>GuessMainPID=</varname></term> | |
220 | ||
221 | <listitem><para>Takes a boolean value | |
222 | that specifies whether systemd should | |
223 | try to guess the main PID of a service | |
224 | should if it cannot be determined | |
225 | reliably. This option is ignored | |
226 | unless <option>Type=forking</option> | |
227 | is set and <option>PIDFile=</option> | |
228 | is unset because for the other types | |
229 | or with an explicitly configured PID | |
230 | file the main PID is always known. The | |
231 | guessing algorithm might come to | |
232 | incorrect conclusions if a daemon | |
233 | consists of more than one process. If | |
234 | the main PID cannot be determined | |
235 | failure detection and automatic | |
236 | restarting of a service will not work | |
237 | reliably. Defaults to | |
238 | <option>yes</option>.</para> | |
239 | </listitem> | |
d1ab0ca0 LP |
240 | </varlistentry> |
241 | ||
242 | <varlistentry> | |
243 | <term><varname>PIDFile=</varname></term> | |
0d624a78 LP |
244 | |
245 | <listitem><para>Takes an absolute file | |
246 | name pointing to the PID file of this | |
247 | daemon. Use of this option is | |
248 | recommended for services where | |
249 | <varname>Type=</varname> is set to | |
be039669 LP |
250 | <option>forking</option>. systemd will |
251 | read the PID of the main process of | |
252 | the daemon after start-up of the | |
253 | service. systemd will not write to the | |
254 | file configured here.</para> | |
d1ab0ca0 LP |
255 | </listitem> |
256 | </varlistentry> | |
257 | ||
258 | <varlistentry> | |
259 | <term><varname>BusName=</varname></term> | |
0d624a78 LP |
260 | |
261 | <listitem><para>Takes a D-Bus bus | |
262 | name, where this service is reachable | |
263 | as. This option is mandatory for | |
264 | services where | |
265 | <varname>Type=</varname> is set to | |
266 | <option>dbus</option>, but its use | |
267 | is otherwise recommended as well if | |
268 | the process takes a name on the D-Bus | |
269 | bus.</para> | |
d1ab0ca0 LP |
270 | </listitem> |
271 | </varlistentry> | |
272 | ||
273 | <varlistentry> | |
274 | <term><varname>ExecStart=</varname></term> | |
0d624a78 LP |
275 | <listitem><para>Takes a command line |
276 | that is executed when this service | |
277 | shall be started up. The first token | |
278 | of the command line must be an | |
279 | absolute file name, then followed by | |
280 | arguments for the process. It is | |
281 | mandatory to set this option for all | |
282 | services. This option may not be | |
b1690fe7 LP |
283 | specified more than once, except when |
284 | <varname>Type=oneshot</varname> is | |
285 | used in which case more than one | |
286 | <varname>ExecStart=</varname> line is | |
287 | accepted which are then invoked one by | |
288 | one, sequentially in the order they | |
289 | appear in the unit file.</para> | |
290 | ||
291 | <para>Optionally, if the absolute file | |
292 | name is prefixed with | |
293 | <literal>@</literal>, the second token | |
294 | will be passed as | |
62adf224 LP |
295 | <literal>argv[0]</literal> to the |
296 | executed process, followed by the | |
b708e7ce LP |
297 | further arguments specified. If the |
298 | first token is prefixed with | |
b1690fe7 | 299 | <literal>-</literal> an exit code of |
b708e7ce | 300 | the command normally considered a |
b1690fe7 | 301 | failure (i.e. non-zero exit status or |
5471472d | 302 | abnormal exit due to signal) is ignored |
b1690fe7 LP |
303 | and considered success. If both |
304 | <literal>-</literal> and | |
305 | <literal>@</literal> are used for the | |
5471472d | 306 | same command the former must precede |
b1690fe7 | 307 | the latter. Unless |
420a0166 LP |
308 | <varname>Type=forking</varname> is |
309 | set, the process started via this | |
310 | command line will be considered the | |
311 | main process of the daemon. The | |
312 | command line accepts % specifiers as | |
313 | described in | |
7734f773 BS |
314 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
315 | ||
316 | <para>On top of that basic environment | |
317 | variable substitution is | |
318 | supported. Use | |
319 | <literal>${FOO}</literal> as part of a | |
320 | word, or as word of its own on the | |
321 | command line, in which case it will be | |
322 | replaced by the value of the | |
323 | environment variable including all | |
324 | whitespace it contains, resulting in a | |
325 | single argument. Use | |
326 | <literal>$FOO</literal> as a separate | |
327 | word on the command line, in which | |
328 | case it will be replaced by the value | |
329 | of the environment variable split up | |
330 | at whitespace, resulting in no or more | |
331 | arguments. Note that the first | |
332 | argument (i.e. the program to execute) | |
333 | may not be a variable, and must be a | |
334 | literal and absolute path | |
335 | name.</para></listitem> | |
0d624a78 LP |
336 | </varlistentry> |
337 | ||
338 | <varlistentry> | |
339 | <term><varname>ExecStartPre=</varname></term> | |
340 | <term><varname>ExecStartPost=</varname></term> | |
341 | <listitem><para>Additional commands | |
342 | that are executed before (resp. after) | |
343 | the command in | |
b3eaa628 LP |
344 | <varname>ExecStart=</varname>. Multiple |
345 | command lines may be concatenated in a | |
c899f8c6 | 346 | single directive, by separating them |
b3eaa628 | 347 | by semicolons (these semicolons must |
96d4ce01 | 348 | be passed as separate words). In that |
b3eaa628 LP |
349 | case, the commands are executed one |
350 | after the other, | |
351 | serially. Alternatively, these | |
352 | directives may be specified more than | |
5471472d | 353 | once with the same effect. However, |
b3eaa628 LP |
354 | the latter syntax is not recommended |
355 | for compatibility with parsers | |
356 | suitable for XDG | |
357 | <filename>.desktop</filename> files. | |
358 | Use of these settings is | |
420a0166 LP |
359 | optional. Specifier and environment |
360 | variable substitution is | |
361 | supported.</para></listitem> | |
0d624a78 LP |
362 | </varlistentry> |
363 | ||
364 | <varlistentry> | |
365 | <term><varname>ExecReload=</varname></term> | |
366 | <listitem><para>Commands to execute to | |
367 | trigger a configuration reload in the | |
b3eaa628 LP |
368 | service. This argument takes multiple |
369 | command lines, following the same | |
370 | scheme as pointed out for | |
371 | <varname>ExecStartPre=</varname> | |
372 | above. Use of this setting is | |
420a0166 LP |
373 | optional. Specifier and environment |
374 | variable substitution is supported | |
375 | here following the same scheme as for | |
376 | <varname>ExecStart=</varname>. One | |
377 | special environment variable is set: | |
378 | if known <literal>$MAINPID</literal> is | |
379 | set to the main process of the | |
380 | daemon, and may be used for command | |
381 | lines like the following: | |
382 | <command>/bin/kill -HUP | |
075b1e86 | 383 | $MAINPID</command>.</para></listitem> |
0d624a78 LP |
384 | </varlistentry> |
385 | ||
386 | <varlistentry> | |
387 | <term><varname>ExecStop=</varname></term> | |
388 | <listitem><para>Commands to execute to | |
389 | stop the service started via | |
b3eaa628 LP |
390 | <varname>ExecStart=</varname>. This |
391 | argument takes multiple command lines, | |
392 | following the same scheme as pointed | |
393 | out for | |
394 | <varname>ExecStartPre=</varname> | |
395 | above. Use of this setting is | |
0d624a78 LP |
396 | optional. All processes remaining for |
397 | a service after the commands | |
398 | configured in this option are run are | |
399 | terminated according to the | |
400 | <varname>KillMode=</varname> setting | |
401 | (see below). If this option is not | |
402 | specified the process is terminated | |
403 | right-away when service stop is | |
420a0166 LP |
404 | requested. Specifier and environment |
405 | variable substitution is supported | |
406 | (including | |
075b1e86 | 407 | <literal>$MAINPID</literal>, see |
420a0166 | 408 | above).</para></listitem> |
0d624a78 LP |
409 | </varlistentry> |
410 | ||
411 | <varlistentry> | |
412 | <term><varname>ExecStopPost=</varname></term> | |
413 | <listitem><para>Additional commands | |
414 | that are executed after the service | |
415 | was stopped using the commands | |
416 | configured in | |
b3eaa628 LP |
417 | <varname>ExecStop=</varname>. This |
418 | argument takes multiple command lines, | |
419 | following the same scheme as pointed | |
420 | out for | |
421 | <varname>ExecStartPre</varname>. Use | |
422 | of these settings is | |
420a0166 LP |
423 | optional. Specifier and environment |
424 | variable substitution is | |
425 | supported.</para></listitem> | |
0d624a78 LP |
426 | </varlistentry> |
427 | ||
428 | <varlistentry> | |
429 | <term><varname>RestartSec=</varname></term> | |
430 | <listitem><para>Configures the time to | |
431 | sleep before restarting a service (as | |
432 | configured with | |
433 | <varname>Restart=</varname>). Takes a | |
434 | unit-less value in seconds, or a time | |
435 | span value such as "5min | |
436 | 20s". Defaults to | |
437 | 100ms.</para></listitem> | |
438 | </varlistentry> | |
439 | ||
440 | <varlistentry> | |
441 | <term><varname>TimeoutSec=</varname></term> | |
442 | <listitem><para>Configures the time to | |
443 | wait for start-up and stop. If a | |
444 | daemon service does not signal | |
445 | start-up completion within the | |
446 | configured time the service will be | |
447 | considered failed and be shut down | |
448 | again. If a service is asked to stop | |
449 | but does not terminate in the | |
450 | specified time it will be terminated | |
451 | forcibly via SIGTERM, and after | |
452 | another delay of this time with | |
453 | SIGKILL. (See | |
62adf224 | 454 | <varname>KillMode=</varname> |
0d624a78 LP |
455 | below.) Takes a unit-less value in seconds, or a |
456 | time span value such as "5min | |
457 | 20s". Pass 0 to disable the timeout | |
458 | logic. Defaults to | |
ecb963cc | 459 | 90s.</para></listitem> |
0d624a78 LP |
460 | </varlistentry> |
461 | ||
bb242b7b MO |
462 | <varlistentry> |
463 | <term><varname>WatchdogSec=</varname></term> | |
e8ab3ccb LP |
464 | <listitem><para>Configures the |
465 | watchdog timeout for a service. This | |
466 | is activated when the start-up is | |
467 | completed. The service must call | |
bb242b7b | 468 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
e8ab3ccb LP |
469 | regularly with "WATCHDOG=1". If the |
470 | time between two such calls is larger | |
471 | than the configured time then the | |
472 | service is placed in a failure | |
473 | state. By setting | |
2707271e | 474 | <varname>Restart=</varname> |
bb242b7b | 475 | to <option>on-failure</option> or |
e8ab3ccb LP |
476 | <option>always</option> the service |
477 | will be automatically restarted. The | |
478 | time configured here will be passed to | |
479 | the executed service process in the | |
480 | <varname>WATCHDOG_USEC=</varname> | |
02c4ef9c LP |
481 | environment variable. If |
482 | this option is used | |
483 | <varname>NotifyAccess=</varname> (see | |
484 | below) should be set to open access to | |
485 | the notification socket provided by | |
486 | systemd. If | |
487 | <varname>NotifyAccess=</varname> is not | |
488 | set, it will be implicitly set to | |
489 | <option>main</option>. Defaults to 0, | |
e8ab3ccb LP |
490 | which disables this |
491 | feature.</para></listitem> | |
bb242b7b MO |
492 | </varlistentry> |
493 | ||
0d624a78 LP |
494 | <varlistentry> |
495 | <term><varname>Restart=</varname></term> | |
496 | <listitem><para>Configures whether the | |
50caaedb | 497 | main service process shall be |
f8553ccb | 498 | restarted when it exits. Takes one of |
525ee6f4 | 499 | <option>no</option>, |
50caaedb LP |
500 | <option>on-success</option>, |
501 | <option>on-failure</option>, | |
502 | <option>on-abort</option> or | |
503 | <option>always</option>. If set to | |
504 | <option>no</option> (the default) the | |
505 | service will not be restarted when it | |
506 | exits. If set to | |
507 | <option>on-success</option> it will be | |
508 | restarted only when it exited cleanly, | |
509 | i.e. terminated with an exit code of | |
510 | 0. If set to | |
511 | <option>on-failure</option> it will be | |
5471472d | 512 | restarted only when it exited with an |
092317d0 LP |
513 | exit code not equalling 0, when |
514 | terminated by a signal, when an | |
515 | operation times out or when the | |
516 | configured watchdog timeout is | |
517 | triggered. If set to | |
50caaedb LP |
518 | <option>on-abort</option> it will be |
519 | restarted only if it exits due to | |
520 | reception of an uncaught signal. If | |
521 | set to <option>always</option> the | |
0d624a78 | 522 | service will be restarted regardless |
092317d0 | 523 | whether it exited cleanly or not, |
0d624a78 | 524 | got terminated abnormally by a |
092317d0 | 525 | signal or hit a timeout.</para></listitem> |
0d624a78 LP |
526 | </varlistentry> |
527 | ||
528 | <varlistentry> | |
529 | <term><varname>PermissionsStartOnly=</varname></term> | |
530 | <listitem><para>Takes a boolean | |
531 | argument. If true, the permission | |
532 | related execution options as | |
533 | configured with | |
534 | <varname>User=</varname> and similar | |
535 | options (see | |
536 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
537 | for more information) are only applied | |
538 | to the process started with | |
539 | <varname>ExecStart=</varname>, and not | |
540 | to the various other | |
541 | <varname>ExecStartPre=</varname>, | |
542 | <varname>ExecStartPost=</varname>, | |
543 | <varname>ExecReload=</varname>, | |
544 | <varname>ExecStop=</varname>, | |
545 | <varname>ExecStopPost=</varname> | |
546 | commands. If false, the setting is | |
547 | applied to all configured commands the | |
548 | same way. Defaults to | |
549 | false.</para></listitem> | |
550 | </varlistentry> | |
551 | ||
552 | <varlistentry> | |
553 | <term><varname>RootDirectoryStartOnly=</varname></term> | |
554 | <listitem><para>Takes a boolean | |
555 | argument. If true, the root directory | |
556 | as configured with the | |
557 | <varname>RootDirectory=</varname> | |
558 | option (see | |
559 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
560 | for more information) is only applied | |
561 | to the process started with | |
562 | <varname>ExecStart=</varname>, and not | |
563 | to the various other | |
564 | <varname>ExecStartPre=</varname>, | |
565 | <varname>ExecStartPost=</varname>, | |
566 | <varname>ExecReload=</varname>, | |
567 | <varname>ExecStop=</varname>, | |
568 | <varname>ExecStopPost=</varname> | |
569 | commands. If false, the setting is | |
570 | applied to all configured commands the | |
571 | same way. Defaults to | |
572 | false.</para></listitem> | |
573 | </varlistentry> | |
574 | ||
575 | <varlistentry> | |
576 | <term><varname>SysVStartPriority=</varname></term> | |
577 | <listitem><para>Set the SysV start | |
578 | priority to use to order this service | |
579 | in relation to SysV services lacking | |
580 | LSB headers. This option is only | |
581 | necessary to fix ordering in relation | |
582 | to legacy SysV services, that have no | |
583 | ordering information encoded in the | |
584 | script headers. As such it should only | |
585 | be used as temporary compatibility | |
586 | option, and not be used in new unit | |
587 | files. Almost always it is a better | |
588 | choice to add explicit ordering | |
589 | directives via | |
590 | <varname>After=</varname> or | |
591 | <varname>Before=</varname>, | |
592 | instead. For more details see | |
593 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If | |
594 | used, pass an integer value in the | |
595 | range 0-99.</para></listitem> | |
596 | </varlistentry> | |
597 | ||
598 | <varlistentry> | |
599 | <term><varname>KillMode=</varname></term> | |
600 | <listitem><para>Specifies how | |
601 | processes of this service shall be | |
602 | killed. One of | |
603 | <option>control-group</option>, | |
0d624a78 LP |
604 | <option>process</option>, |
605 | <option>none</option>.</para> | |
606 | ||
607 | <para>If set to | |
608 | <option>control-group</option> all | |
609 | remaining processes in the control | |
610 | group of this service will be | |
611 | terminated on service stop, after the | |
612 | stop command (as configured with | |
613 | <varname>ExecStop=</varname>) is | |
614 | executed. If set to | |
0d624a78 LP |
615 | <option>process</option> only the main |
616 | process itself is killed. If set to | |
617 | <option>none</option> no process is | |
618 | killed. In this case only the stop | |
619 | command will be executed on service | |
620 | stop, but no process be killed | |
621 | otherwise. Processes remaining alive | |
622 | after stop are left in their control | |
623 | group and the control group continues | |
624 | to exist after stop unless it is | |
625 | empty. Defaults to | |
f8553ccb | 626 | <option>control-group</option>.</para> |
0d624a78 LP |
627 | |
628 | <para>Processes will first be | |
ba035df2 LP |
629 | terminated via SIGTERM (unless the |
630 | signal to send is changed via | |
2292707d LP |
631 | <varname>KillSignal=</varname>). If |
632 | then after a delay (configured via the | |
62adf224 | 633 | <varname>TimeoutSec=</varname> option) |
0d624a78 LP |
634 | processes still remain, the |
635 | termination request is repeated with | |
ba035df2 LP |
636 | the SIGKILL signal (unless this is |
637 | disabled via the | |
638 | <varname>SendSIGKILL=</varname> | |
639 | option). See | |
0d624a78 LP |
640 | <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
641 | for more | |
642 | information.</para></listitem> | |
643 | </varlistentry> | |
644 | ||
2292707d LP |
645 | <varlistentry> |
646 | <term><varname>KillSignal=</varname></term> | |
647 | <listitem><para>Specifies which signal | |
648 | to use when killing a | |
649 | service. Defaults to SIGTERM. | |
650 | </para></listitem> | |
651 | </varlistentry> | |
652 | ||
ba035df2 LP |
653 | <varlistentry> |
654 | <term><varname>SendSIGKILL=</varname></term> | |
655 | <listitem><para>Specifies whether to | |
656 | send SIGKILL to remaining processes | |
657 | after a timeout, if the normal | |
658 | shutdown procedure left processes of | |
659 | the service around. Takes a boolean | |
660 | value. Defaults to "yes". | |
661 | </para></listitem> | |
662 | </varlistentry> | |
663 | ||
0d624a78 LP |
664 | <varlistentry> |
665 | <term><varname>NonBlocking=</varname></term> | |
666 | <listitem><para>Set O_NONBLOCK flag | |
667 | for all file descriptors passed via | |
668 | socket-based activation. If true, all | |
669 | file descriptors >= 3 (i.e. all except | |
670 | STDIN/STDOUT/STDERR) will have | |
671 | the O_NONBLOCK flag set and hence are in | |
672 | non-blocking mode. This option is only | |
673 | useful in conjunction with a socket | |
674 | unit, as described in | |
675 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Defaults | |
676 | to false.</para></listitem> | |
677 | </varlistentry> | |
678 | ||
679 | <varlistentry> | |
680 | <term><varname>NotifyAccess=</varname></term> | |
681 | <listitem><para>Controls access to the | |
682 | service status notification socket, as | |
683 | accessible via the | |
684 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
685 | call. Takes one of | |
686 | <option>none</option> (the default), | |
687 | <option>main</option> or | |
688 | <option>all</option>. If | |
689 | <option>none</option> no daemon status | |
f8553ccb | 690 | updates are accepted from the service |
0d624a78 LP |
691 | processes, all status update messages |
692 | are ignored. If <option>main</option> | |
693 | only service updates sent from the | |
694 | main process of the service are | |
695 | accepted. If <option>all</option> all | |
696 | services updates from all members of | |
697 | the service's control group are | |
02c4ef9c | 698 | accepted. This option should be set to |
0d624a78 LP |
699 | open access to the notification socket |
700 | when using | |
02c4ef9c LP |
701 | <varname>Type=notify</varname> or |
702 | <varname>WatchdogUsec=</varname> (see | |
703 | above). If those options are used but | |
704 | <varname>NotifyAccess=</varname> not | |
705 | configured it will be implicitly set | |
706 | to | |
707 | <option>main</option>.</para></listitem> | |
d1ab0ca0 LP |
708 | </varlistentry> |
709 | ||
f72192c0 LP |
710 | <varlistentry> |
711 | <term><varname>Sockets=</varname></term> | |
712 | <listitem><para>Specifies the name of | |
713 | the socket units this service shall | |
714 | inherit the sockets from when the | |
4f025f4c | 715 | service is started. Normally it |
f72192c0 LP |
716 | should not be necessary to use this |
717 | setting as all sockets whose unit | |
718 | shares the same name as the service | |
4f025f4c | 719 | (ignoring the different suffix of course) |
f72192c0 LP |
720 | are passed to the spawned |
721 | process.</para> | |
722 | ||
723 | <para>Note that the same socket may be | |
724 | passed to multiple processes at the | |
725 | same time. Also note that a different | |
726 | service may be activated on incoming | |
727 | traffic than inherits the sockets. Or | |
728 | in other words: The | |
729 | <varname>Service=</varname> setting of | |
730 | <filename>.socket</filename> units | |
731 | doesn't have to match the inverse of the | |
a1102c1f | 732 | <varname>Sockets=</varname> setting of |
f72192c0 LP |
733 | the <filename>.service</filename> it |
734 | refers to.</para></listitem> | |
735 | </varlistentry> | |
736 | ||
2ba545f1 LP |
737 | <varlistentry> |
738 | <term><varname>FsckPassNo=</varname></term> | |
739 | <listitem><para>Set the fsck passno | |
740 | priority to use to order this service | |
741 | in relation to other file system | |
742 | checking services. This option is only | |
743 | necessary to fix ordering in relation | |
744 | to fsck jobs automatically created for | |
745 | all <filename>/etc/fstab</filename> | |
746 | entries with a value in the fs_passno | |
747 | column > 0. As such it should only be | |
748 | used as option for fsck | |
749 | services. Almost always it is a better | |
750 | choice to add explicit ordering | |
751 | directives via | |
752 | <varname>After=</varname> or | |
753 | <varname>Before=</varname>, | |
754 | instead. For more details see | |
755 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If | |
756 | used, pass an integer value in the | |
757 | same range as | |
758 | <filename>/etc/fstab</filename>'s | |
759 | fs_passno column. See | |
760 | <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
761 | for details.</para></listitem> | |
762 | </varlistentry> | |
763 | ||
092317d0 LP |
764 | <varlistentry> |
765 | <term><varname>StartLimitInterval=</varname></term> | |
766 | <term><varname>StartLimitBurst=</varname></term> | |
767 | ||
768 | <listitem><para>Configure service | |
769 | start rate limiting. By default | |
770 | services which are started more often | |
771 | than 5 times within 10s are not | |
772 | permitted to start any more times | |
773 | until the 10s interval ends. With | |
774 | these two options this rate limiting | |
775 | may be modified. Use | |
776 | <varname>StartLimitInterval=</varname> | |
777 | to configure the checking interval | |
778 | (defaults to 10s, set to 0 to disable | |
779 | any kind of rate limiting). Use | |
780 | <varname>StartLimitBurst=</varname> to | |
781 | configure how many starts per interval | |
782 | are allowed (defaults to 5). These | |
783 | configuration options are particularly | |
784 | useful in conjunction with | |
785 | <varname>Restart=</varname>.</para></listitem> | |
786 | </varlistentry> | |
787 | ||
788 | <varlistentry> | |
789 | <term><varname>StartLimitAction=</varname></term> | |
790 | ||
791 | <listitem><para>Configure the action | |
792 | to take if the rate limit configured | |
793 | with | |
794 | <varname>StartLimitInterval=</varname> | |
795 | and | |
796 | <varname>StartLimitBurst=</varname> is | |
797 | hit. Takes one of | |
798 | <option>none</option>, | |
799 | <option>reboot</option>, | |
800 | <option>reboot-force</option> or | |
801 | <option>reboot-immediate</option>. If | |
802 | <option>none</option> is set, | |
803 | hitting the rate limit will trigger no | |
804 | action besides that the start will not | |
805 | be | |
806 | permitted. <option>reboot</option> | |
807 | causes a reboot following the normal | |
808 | shutdown procedure (i.e. equivalent to | |
809 | <command>systemctl reboot</command>), | |
810 | <option>reboot-force</option> causes | |
811 | an forced reboot which will terminate | |
812 | all processes forcibly but should | |
813 | cause no dirty file systems on reboot | |
814 | (i.e. equivalent to <command>systemctl | |
815 | reboot -f</command>) and | |
816 | <option>reboot-immediate</option> | |
817 | causes immediate execution of the | |
818 | <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
819 | system call, which might result in | |
820 | data loss. Defaults to | |
821 | <option>none</option>.</para></listitem> | |
822 | </varlistentry> | |
823 | ||
d1ab0ca0 LP |
824 | </variablelist> |
825 | </refsect1> | |
826 | ||
827 | <refsect1> | |
828 | <title>See Also</title> | |
829 | <para> | |
f3e219a2 | 830 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
0d624a78 LP |
831 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
832 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
833 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
d1ab0ca0 LP |
834 | </para> |
835 | </refsect1> | |
836 | ||
837 | </refentry> |