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