]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.service.xml
man: add reference to export format spec to journalctl
[thirdparty/systemd.git] / man / systemd.service.xml
CommitLineData
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>
34511ca7 47 <refpurpose>Service unit configuration</refpurpose>
d1ab0ca0
LP
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 537 exit code not equalling 0, when
5389fedd
LP
538 terminated by a signal (including on
539 core dump), when an operation (such as
540 service reload) times out or when the
092317d0
LP
541 configured watchdog timeout is
542 triggered. If set to
50caaedb
LP
543 <option>on-abort</option> it will be
544 restarted only if it exits due to
5389fedd
LP
545 reception of an uncaught signal
546 (including on core dump). If set to
547 <option>always</option> the service
548 will be restarted regardless whether
549 it exited cleanly or not, got
550 terminated abnormally by a signal or
551 hit a timeout.</para></listitem>
0d624a78
LP
552 </varlistentry>
553
554 <varlistentry>
555 <term><varname>PermissionsStartOnly=</varname></term>
556 <listitem><para>Takes a boolean
557 argument. If true, the permission
558 related execution options as
559 configured with
560 <varname>User=</varname> and similar
561 options (see
562 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
563 for more information) are only applied
564 to the process started with
565 <varname>ExecStart=</varname>, and not
566 to the various other
567 <varname>ExecStartPre=</varname>,
568 <varname>ExecStartPost=</varname>,
569 <varname>ExecReload=</varname>,
570 <varname>ExecStop=</varname>,
571 <varname>ExecStopPost=</varname>
572 commands. If false, the setting is
573 applied to all configured commands the
574 same way. Defaults to
575 false.</para></listitem>
576 </varlistentry>
577
578 <varlistentry>
579 <term><varname>RootDirectoryStartOnly=</varname></term>
580 <listitem><para>Takes a boolean
581 argument. If true, the root directory
582 as configured with the
583 <varname>RootDirectory=</varname>
584 option (see
585 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
586 for more information) is only applied
587 to the process started with
588 <varname>ExecStart=</varname>, and not
589 to the various other
590 <varname>ExecStartPre=</varname>,
591 <varname>ExecStartPost=</varname>,
592 <varname>ExecReload=</varname>,
593 <varname>ExecStop=</varname>,
594 <varname>ExecStopPost=</varname>
595 commands. If false, the setting is
596 applied to all configured commands the
597 same way. Defaults to
598 false.</para></listitem>
599 </varlistentry>
600
0d624a78
LP
601 <varlistentry>
602 <term><varname>KillMode=</varname></term>
603 <listitem><para>Specifies how
604 processes of this service shall be
605 killed. One of
606 <option>control-group</option>,
0d624a78
LP
607 <option>process</option>,
608 <option>none</option>.</para>
609
610 <para>If set to
611 <option>control-group</option> all
612 remaining processes in the control
613 group of this service will be
614 terminated on service stop, after the
615 stop command (as configured with
616 <varname>ExecStop=</varname>) is
617 executed. If set to
0d624a78
LP
618 <option>process</option> only the main
619 process itself is killed. If set to
620 <option>none</option> no process is
621 killed. In this case only the stop
622 command will be executed on service
623 stop, but no process be killed
624 otherwise. Processes remaining alive
625 after stop are left in their control
626 group and the control group continues
627 to exist after stop unless it is
628 empty. Defaults to
f8553ccb 629 <option>control-group</option>.</para>
0d624a78
LP
630
631 <para>Processes will first be
ba035df2
LP
632 terminated via SIGTERM (unless the
633 signal to send is changed via
2292707d
LP
634 <varname>KillSignal=</varname>). If
635 then after a delay (configured via the
62adf224 636 <varname>TimeoutSec=</varname> option)
0d624a78
LP
637 processes still remain, the
638 termination request is repeated with
ba035df2
LP
639 the SIGKILL signal (unless this is
640 disabled via the
641 <varname>SendSIGKILL=</varname>
642 option). See
0d624a78
LP
643 <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry>
644 for more
645 information.</para></listitem>
646 </varlistentry>
647
2292707d
LP
648 <varlistentry>
649 <term><varname>KillSignal=</varname></term>
650 <listitem><para>Specifies which signal
651 to use when killing a
652 service. Defaults to SIGTERM.
653 </para></listitem>
654 </varlistentry>
655
ba035df2
LP
656 <varlistentry>
657 <term><varname>SendSIGKILL=</varname></term>
658 <listitem><para>Specifies whether to
659 send SIGKILL to remaining processes
660 after a timeout, if the normal
661 shutdown procedure left processes of
662 the service around. Takes a boolean
663 value. Defaults to "yes".
664 </para></listitem>
665 </varlistentry>
666
0d624a78
LP
667 <varlistentry>
668 <term><varname>NonBlocking=</varname></term>
669 <listitem><para>Set O_NONBLOCK flag
670 for all file descriptors passed via
671 socket-based activation. If true, all
672 file descriptors >= 3 (i.e. all except
673 STDIN/STDOUT/STDERR) will have
674 the O_NONBLOCK flag set and hence are in
675 non-blocking mode. This option is only
676 useful in conjunction with a socket
677 unit, as described in
678 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Defaults
679 to false.</para></listitem>
680 </varlistentry>
681
682 <varlistentry>
683 <term><varname>NotifyAccess=</varname></term>
684 <listitem><para>Controls access to the
685 service status notification socket, as
686 accessible via the
687 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
688 call. Takes one of
689 <option>none</option> (the default),
690 <option>main</option> or
691 <option>all</option>. If
692 <option>none</option> no daemon status
f8553ccb 693 updates are accepted from the service
0d624a78
LP
694 processes, all status update messages
695 are ignored. If <option>main</option>
696 only service updates sent from the
697 main process of the service are
698 accepted. If <option>all</option> all
699 services updates from all members of
700 the service's control group are
02c4ef9c 701 accepted. This option should be set to
0d624a78
LP
702 open access to the notification socket
703 when using
02c4ef9c
LP
704 <varname>Type=notify</varname> or
705 <varname>WatchdogUsec=</varname> (see
706 above). If those options are used but
707 <varname>NotifyAccess=</varname> not
708 configured it will be implicitly set
709 to
710 <option>main</option>.</para></listitem>
d1ab0ca0
LP
711 </varlistentry>
712
f72192c0
LP
713 <varlistentry>
714 <term><varname>Sockets=</varname></term>
715 <listitem><para>Specifies the name of
716 the socket units this service shall
717 inherit the sockets from when the
4f025f4c 718 service is started. Normally it
f72192c0
LP
719 should not be necessary to use this
720 setting as all sockets whose unit
721 shares the same name as the service
4f025f4c 722 (ignoring the different suffix of course)
f72192c0
LP
723 are passed to the spawned
724 process.</para>
725
726 <para>Note that the same socket may be
727 passed to multiple processes at the
728 same time. Also note that a different
729 service may be activated on incoming
730 traffic than inherits the sockets. Or
731 in other words: The
732 <varname>Service=</varname> setting of
733 <filename>.socket</filename> units
734 doesn't have to match the inverse of the
a1102c1f 735 <varname>Sockets=</varname> setting of
f72192c0
LP
736 the <filename>.service</filename> it
737 refers to.</para></listitem>
738 </varlistentry>
739
092317d0
LP
740 <varlistentry>
741 <term><varname>StartLimitInterval=</varname></term>
742 <term><varname>StartLimitBurst=</varname></term>
743
744 <listitem><para>Configure service
745 start rate limiting. By default
746 services which are started more often
747 than 5 times within 10s are not
748 permitted to start any more times
749 until the 10s interval ends. With
750 these two options this rate limiting
751 may be modified. Use
752 <varname>StartLimitInterval=</varname>
753 to configure the checking interval
754 (defaults to 10s, set to 0 to disable
755 any kind of rate limiting). Use
756 <varname>StartLimitBurst=</varname> to
757 configure how many starts per interval
758 are allowed (defaults to 5). These
759 configuration options are particularly
760 useful in conjunction with
6ffd3337
LP
761 <varname>Restart=</varname>, however
762 apply to all kinds of starts
763 (including manual), not just those
764 triggered by the
765 <varname>Restart=</varname> logic.
766 Note that units which are configured
767 for <varname>Restart=</varname> and
768 which reach the start limit are not
f1c8f75b
LP
769 attempted to be restarted anymore,
770 however they may still be restarted
771 manually at a later point from which
772 point on the restart logic is again
451b34cc
LP
773 activated. Note that
774 <command>systemctl
775 reset-failed</command> will cause the
776 restart rate counter for a service to
777 be flushed, which is useful if the
778 administrator wants to manually start
779 a service and the start limit
780 interferes with
781 that.</para></listitem>
092317d0
LP
782 </varlistentry>
783
784 <varlistentry>
785 <term><varname>StartLimitAction=</varname></term>
786
787 <listitem><para>Configure the action
788 to take if the rate limit configured
789 with
790 <varname>StartLimitInterval=</varname>
791 and
792 <varname>StartLimitBurst=</varname> is
793 hit. Takes one of
794 <option>none</option>,
795 <option>reboot</option>,
796 <option>reboot-force</option> or
797 <option>reboot-immediate</option>. If
798 <option>none</option> is set,
799 hitting the rate limit will trigger no
800 action besides that the start will not
801 be
802 permitted. <option>reboot</option>
803 causes a reboot following the normal
804 shutdown procedure (i.e. equivalent to
805 <command>systemctl reboot</command>),
806 <option>reboot-force</option> causes
807 an forced reboot which will terminate
808 all processes forcibly but should
809 cause no dirty file systems on reboot
810 (i.e. equivalent to <command>systemctl
811 reboot -f</command>) and
812 <option>reboot-immediate</option>
813 causes immediate execution of the
814 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
815 system call, which might result in
816 data loss. Defaults to
817 <option>none</option>.</para></listitem>
818 </varlistentry>
819
d1ab0ca0
LP
820 </variablelist>
821 </refsect1>
822
c485d3ba
LP
823 <refsect1>
824 <title>Compatibility Options</title>
825
826 <para>The following options are also available in the
827 <literal>[Service]</literal> section, but exist purely
828 for compatibility reasons and should not be used in
829 newly written service files.</para>
830
831 <variablelist>
832 <varlistentry>
833 <term><varname>SysVStartPriority=</varname></term>
834 <listitem><para>Set the SysV start
835 priority to use to order this service
836 in relation to SysV services lacking
837 LSB headers. This option is only
838 necessary to fix ordering in relation
839 to legacy SysV services, that have no
840 ordering information encoded in the
841 script headers. As such it should only
842 be used as temporary compatibility
843 option, and not be used in new unit
844 files. Almost always it is a better
845 choice to add explicit ordering
846 directives via
847 <varname>After=</varname> or
848 <varname>Before=</varname>,
849 instead. For more details see
850 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
851 used, pass an integer value in the
852 range 0-99.</para></listitem>
853 </varlistentry>
854
855 <varlistentry>
856 <term><varname>FsckPassNo=</varname></term>
857 <listitem><para>Set the fsck passno
858 priority to use to order this service
859 in relation to other file system
860 checking services. This option is only
861 necessary to fix ordering in relation
862 to fsck jobs automatically created for
863 all <filename>/etc/fstab</filename>
864 entries with a value in the fs_passno
865 column > 0. As such it should only be
866 used as option for fsck
867 services. Almost always it is a better
868 choice to add explicit ordering
869 directives via
870 <varname>After=</varname> or
871 <varname>Before=</varname>,
872 instead. For more details see
873 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
874 used, pass an integer value in the
875 same range as
876 <filename>/etc/fstab</filename>'s
877 fs_passno column. See
878 <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
879 for details.</para></listitem>
880 </varlistentry>
881
882 </variablelist>
883 </refsect1>
884
d1ab0ca0
LP
885 <refsect1>
886 <title>See Also</title>
887 <para>
f3e219a2 888 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
0d624a78
LP
889 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
890 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
891 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
d1ab0ca0
LP
892 </para>
893 </refsect1>
894
895</refentry>