]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.service.xml
man: wording and grammar updates
[thirdparty/systemd.git] / man / systemd.service.xml
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
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
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
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
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>Service unit configuration</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <para><filename><replaceable>service</replaceable>.service</filename></para>
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para>A unit configuration file whose name ends in
58 <filename>.service</filename> encodes information
59 about a process controlled and supervised by
60 systemd.</para>
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
66 files. The common configuration items are configured
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>
71
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, and in
76 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
77 which define the way the processes of the service are
78 terminated, and in
79 <citerefentry><refentrytitle>systemd.cgroup</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
80 which configure control group settings for the
81 processes of the service.</para>
82
83 <para>Unless <varname>DefaultDependencies=</varname>
84 is set to <option>false</option>, service units will
85 implicitly have dependencies of type
86 <varname>Requires=</varname> and
87 <varname>After=</varname> on
88 <filename>basic.target</filename> as well as
89 dependencies of type <varname>Conflicts=</varname> and
90 <varname>Before=</varname> on
91 <filename>shutdown.target</filename>. These ensure
92 that normal service units pull in basic system
93 initialization, and are terminated cleanly prior to
94 system shutdown. Only services involved with early
95 boot or late system shutdown should disable this
96 option.</para>
97
98 <para>If a service is requested under a certain name
99 but no unit configuration file is found, systemd looks
100 for a SysV init script by the same name (with the
101 <filename>.service</filename> suffix removed) and
102 dynamically creates a service unit from that
103 script. This is useful for compatibility with
104 SysV. Note that this compatibility is quite
105 comprehensive but not 100%. For details about the
106 incompatibilities see the <ulink
107 url="http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities">Incompatibilities
108 with SysV</ulink> document.
109 </para>
110 </refsect1>
111
112 <refsect1>
113 <title>Options</title>
114
115 <para>Service files must include a
116 <literal>[Service]</literal> section, which carries
117 information about the service and the process it
118 supervises. A number of options that may be used in
119 this section are shared with other unit types. These
120 options are documented in
121 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
122 and
123 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
124 options specific to the <literal>[Service]</literal>
125 section of service units are the following:</para>
126
127 <variablelist class='unit-directives'>
128 <varlistentry>
129 <term><varname>Type=</varname></term>
130
131 <listitem><para>Configures the process
132 start-up type for this service
133 unit. One of <option>simple</option>,
134 <option>forking</option>,
135 <option>oneshot</option>,
136 <option>dbus</option>,
137 <option>notify</option> or
138 <option>idle</option>.</para>
139
140 <para>If set to
141 <option>simple</option> (the default
142 value if <varname>BusName=</varname>
143 is not specified) it is expected that
144 the process configured with
145 <varname>ExecStart=</varname> is the
146 main process of the service. In this
147 mode, if the process offers
148 functionality to other processes on
149 the system its communication channels
150 should be installed before the daemon
151 is started up (e.g. sockets set up by
152 systemd, via socket activation), as
153 systemd will immediately proceed
154 starting follow-up units.</para>
155
156 <para>If set to
157 <option>forking</option> it is
158 expected that the process configured
159 with <varname>ExecStart=</varname>
160 will call <function>fork()</function>
161 as part of its start-up. The parent process is
162 expected to exit when start-up is
163 complete and all communication
164 channels set up. The child continues
165 to run as the main daemon
166 process. This is the behavior of
167 traditional UNIX daemons. If this
168 setting is used, it is recommended to
169 also use the
170 <varname>PIDFile=</varname> option, so
171 that systemd can identify the main
172 process of the daemon. systemd will
173 proceed starting follow-up units as
174 soon as the parent process
175 exits.</para>
176
177 <para>Behavior of
178 <option>oneshot</option> is similar
179 to <option>simple</option>, however
180 it is expected that the process has to
181 exit before systemd starts follow-up
182 units. <varname>RemainAfterExit=</varname>
183 is particularly useful for this type
184 of service.</para>
185
186 <para>Behavior of
187 <option>dbus</option> is similar to
188 <option>simple</option>, however it is
189 expected that the daemon acquires a
190 name on the D-Bus bus, as configured
191 by
192 <varname>BusName=</varname>. systemd
193 will proceed starting follow-up units
194 after the D-Bus bus name has been
195 acquired. Service units with this
196 option configured implicitly gain
197 dependencies on the
198 <filename>dbus.socket</filename>
199 unit. This type is the default if
200 <varname>BusName=</varname> is
201 specified.</para>
202
203 <para>Behavior of
204 <option>notify</option> is similar to
205 <option>simple</option>, however it is
206 expected that the daemon sends a
207 notification message via
208 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
209 or an equivalent call when it finished
210 starting up. systemd will proceed
211 starting follow-up units after this
212 notification message has been sent. If
213 this option is used
214 <varname>NotifyAccess=</varname> (see
215 below) should be set to open access to
216 the notification socket provided by
217 systemd. If
218 <varname>NotifyAccess=</varname> is
219 not set, it will be implicitly set to
220 <option>main</option>.</para>
221
222 <para>Behavior of
223 <option>idle</option> is very similar
224 to <option>simple</option>, however
225 actual execution of the service
226 binary is delayed until all jobs are
227 dispatched. This may be used to avoid
228 interleaving of output of shell
229 services with the status output on the
230 console.</para>
231 </listitem>
232 </varlistentry>
233
234 <varlistentry>
235 <term><varname>RemainAfterExit=</varname></term>
236
237 <listitem><para>Takes a boolean value
238 that specifies whether the service
239 shall be considered active even when
240 all its processes exited. Defaults to
241 <option>no</option>.</para>
242 </listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><varname>GuessMainPID=</varname></term>
247
248 <listitem><para>Takes a boolean value
249 that specifies whether systemd should
250 try to guess the main PID of a service
251 if it cannot be determined
252 reliably. This option is ignored
253 unless <option>Type=forking</option>
254 is set and <option>PIDFile=</option>
255 is unset because for the other types
256 or with an explicitly configured PID
257 file the main PID is always known. The
258 guessing algorithm might come to
259 incorrect conclusions if a daemon
260 consists of more than one process. If
261 the main PID cannot be determined
262 failure detection and automatic
263 restarting of a service will not work
264 reliably. Defaults to
265 <option>yes</option>.</para>
266 </listitem>
267 </varlistentry>
268
269 <varlistentry>
270 <term><varname>PIDFile=</varname></term>
271
272 <listitem><para>Takes an absolute file
273 name pointing to the PID file of this
274 daemon. Use of this option is
275 recommended for services where
276 <varname>Type=</varname> is set to
277 <option>forking</option>. systemd will
278 read the PID of the main process of
279 the daemon after start-up of the
280 service. systemd will not write to the
281 file configured here.</para>
282 </listitem>
283 </varlistentry>
284
285 <varlistentry>
286 <term><varname>BusName=</varname></term>
287
288 <listitem><para>Takes a D-Bus bus
289 name, that this service is reachable
290 as. This option is mandatory for
291 services where
292 <varname>Type=</varname> is set to
293 <option>dbus</option>, but its use
294 is otherwise recommended as well if
295 the process takes a name on the D-Bus
296 bus.</para>
297 </listitem>
298 </varlistentry>
299
300 <varlistentry>
301 <term><varname>ExecStart=</varname></term>
302 <listitem><para>Commands with their
303 arguments that are executed when this
304 service is started. The first
305 argument must be an absolute path
306 name.</para>
307
308 <para>When <varname>Type</varname> is
309 not <option>oneshot</option>, only one
310 command may be given. When
311 <varname>Type=oneshot</varname> is
312 used, more than one command may be
313 specified. Multiple command lines may
314 be concatenated in a single directive,
315 by separating them with semicolons
316 (these semicolons must be passed as
317 separate words). Alternatively, this
318 directive may be specified more than
319 once with the same effect. However,
320 the latter syntax is not recommended
321 for compatibility with parsers
322 suitable for XDG
323 <filename>.desktop</filename> files.
324 Lone semicolons may be escaped as
325 <literal>\;</literal>. If the empty
326 string is assigned to this option the
327 list of commands to start is reset,
328 prior assignments of this option will
329 have no effect.</para>
330
331 <para>If more than one command is
332 specified, the commands are invoked
333 one by one sequentially in the order
334 they appear in the unit file. If one
335 of the commands fails (and is not
336 prefixed with <literal>-</literal>),
337 other lines are not executed and the
338 unit is considered failed.</para>
339
340 <para>Unless
341 <varname>Type=forking</varname> is
342 set, the process started via this
343 command line will be considered the
344 main process of the daemon.</para>
345
346 <para>The command line accepts
347 <literal>%</literal> specifiers as
348 described in
349 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note
350 that the first argument of the command
351 line (i.e. the program to execute) may
352 not include specifiers.</para>
353
354 <para>Basic environment variable
355 substitution is supported. Use
356 <literal>${FOO}</literal> as part of a
357 word, or as a word of its own on the
358 command line, in which case it will be
359 replaced by the value of the
360 environment variable including all
361 whitespace it contains, resulting in a
362 single argument. Use
363 <literal>$FOO</literal> as a separate
364 word on the command line, in which
365 case it will be replaced by the value
366 of the environment variable split up
367 at whitespace, resulting in zero or
368 more arguments. Note that the first
369 argument (i.e. the program to execute)
370 may not be a variable, since it must
371 be a literal and absolute path
372 name.</para>
373
374 <para>Optionally, if the absolute file
375 name is prefixed with
376 <literal>@</literal>, the second token
377 will be passed as
378 <literal>argv[0]</literal> to the
379 executed process, followed by the
380 further arguments specified. If the
381 absolute filename is prefixed with
382 <literal>-</literal> an exit code of
383 the command normally considered a
384 failure (i.e. non-zero exit status or
385 abnormal exit due to signal) is ignored
386 and considered success. If both
387 <literal>-</literal> and
388 <literal>@</literal> are used they
389 can appear in either order.</para>
390
391 <para>Note that this setting does not
392 directly support shell command
393 lines. If shell command lines are to
394 be used they need to be passed
395 explicitly to a shell implementation
396 of some kind. Example:</para>
397 <programlisting>ExecStart=/bin/sh -c 'dmesg | tac'
398 </programlisting>
399
400 <para>For services run by a user
401 instance of systemd the special
402 environment variable
403 <varname>$MANAGERPID</varname> is set
404 to the PID of the systemd
405 instance.</para>
406 </listitem>
407 </varlistentry>
408
409 <varlistentry>
410 <term><varname>ExecStartPre=</varname></term>
411 <term><varname>ExecStartPost=</varname></term>
412 <listitem><para>Additional commands
413 that are executed before or after
414 the command in
415 <varname>ExecStart=</varname>, respectively.
416 Syntax is the same as for
417 <varname>ExecStart=</varname>, except
418 that multiple command lines are allowed
419 and the commands are executed one
420 after the other, serially.</para>
421
422 <para>If any of those commands (not
423 prefixed with <literal>-</literal>)
424 fail, the rest are not executed and
425 the unit is considered failed.</para>
426 </listitem>
427 </varlistentry>
428
429 <varlistentry>
430 <term><varname>ExecReload=</varname></term>
431 <listitem><para>Commands to execute to
432 trigger a configuration reload in the
433 service. This argument takes multiple
434 command lines, following the same
435 scheme as described for
436 <varname>ExecStart=</varname>
437 above. Use of this setting is
438 optional. Specifier and environment
439 variable substitution is supported
440 here following the same scheme as for
441 <varname>ExecStart=</varname>.</para>
442
443 <para>One additional special
444 environment variables is set: if known
445 <varname>$MAINPID</varname> is set to
446 the main process of the daemon, and
447 may be used for command lines like the
448 following:</para>
449
450 <programlisting>/bin/kill -HUP $MAINPID</programlisting>
451 </listitem>
452 </varlistentry>
453
454 <varlistentry>
455 <term><varname>ExecStop=</varname></term>
456 <listitem><para>Commands to execute to
457 stop the service started via
458 <varname>ExecStart=</varname>. This
459 argument takes multiple command lines,
460 following the same scheme as described
461 for <varname>ExecStart=</varname>
462 above. Use of this setting is
463 optional. All processes remaining for
464 a service after the commands
465 configured in this option are run are
466 terminated according to the
467 <varname>KillMode=</varname> setting
468 (see
469 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>). If
470 this option is not specified the
471 process is terminated right-away when
472 service stop is requested. Specifier
473 and environment variable substitution
474 is supported (including
475 <varname>$MAINPID</varname>, see
476 above).</para></listitem>
477 </varlistentry>
478
479 <varlistentry>
480 <term><varname>ExecStopPost=</varname></term>
481 <listitem><para>Additional commands
482 that are executed after the service
483 was stopped. This includes cases where
484 the commands configured in
485 <varname>ExecStop=</varname> were used,
486 where the service does not have any
487 <varname>ExecStop=</varname> defined, or
488 where the service exited unexpectedly. This
489 argument takes multiple command lines,
490 following the same scheme as described
491 for <varname>ExecStart</varname>. Use
492 of these settings is
493 optional. Specifier and environment
494 variable substitution is
495 supported.</para></listitem>
496 </varlistentry>
497
498 <varlistentry>
499 <term><varname>RestartSec=</varname></term>
500 <listitem><para>Configures the time to
501 sleep before restarting a service (as
502 configured with
503 <varname>Restart=</varname>). Takes a
504 unit-less value in seconds, or a time
505 span value such as "5min
506 20s". Defaults to
507 100ms.</para></listitem>
508 </varlistentry>
509
510 <varlistentry>
511 <term><varname>TimeoutStartSec=</varname></term>
512 <listitem><para>Configures the time to
513 wait for start-up. If a
514 daemon service does not signal
515 start-up completion within the
516 configured time, the service will be
517 considered failed and be shut down
518 again.
519 Takes a unit-less value in seconds, or a
520 time span value such as "5min
521 20s". Pass 0 to disable the timeout
522 logic. Defaults to 90s, except when
523 <varname>Type=oneshot</varname> is
524 used in which case the timeout
525 is disabled by default.
526 </para></listitem>
527 </varlistentry>
528
529 <varlistentry>
530 <term><varname>TimeoutStopSec=</varname></term>
531 <listitem><para>Configures the time to
532 wait for stop. If a service is asked
533 to stop but does not terminate in the
534 specified time, it will be terminated
535 forcibly via <constant>SIGTERM</constant>, and after
536 another delay of this time with
537 <constant>SIGKILL</constant> (See
538 <varname>KillMode=</varname>
539 in <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
540 Takes a unit-less value in seconds, or a
541 time span value such as "5min
542 20s". Pass 0 to disable the timeout
543 logic. Defaults to 90s.
544 </para></listitem>
545 </varlistentry>
546
547 <varlistentry>
548 <term><varname>TimeoutSec=</varname></term>
549 <listitem><para>A shorthand for configuring
550 both <varname>TimeoutStartSec=</varname>
551 and <varname>TimeoutStopSec=</varname>
552 to the specified value.
553 </para></listitem>
554 </varlistentry>
555
556 <varlistentry>
557 <term><varname>WatchdogSec=</varname></term>
558 <listitem><para>Configures the
559 watchdog timeout for a service. The
560 watchdog is activated when the start-up is
561 completed. The service must call
562 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
563 regularly with "WATCHDOG=1" (i.e. the
564 "keep-alive ping"). If the time
565 between two such calls is larger than
566 the configured time then the service
567 is placed in a failure state. By
568 setting <varname>Restart=</varname> to
569 <option>on-failure</option> or
570 <option>always</option> the service
571 will be automatically restarted. The
572 time configured here will be passed to
573 the executed service process in the
574 <varname>WATCHDOG_USEC=</varname>
575 environment variable. This allows
576 daemons to automatically enable the
577 keep-alive pinging logic if watchdog
578 support is enabled for the service. If
579 this option is used
580 <varname>NotifyAccess=</varname> (see
581 below) should be set to open access to
582 the notification socket provided by
583 systemd. If
584 <varname>NotifyAccess=</varname> is
585 not set, it will be implicitly set to
586 <option>main</option>. Defaults to 0,
587 which disables this
588 feature.</para></listitem>
589 </varlistentry>
590
591 <varlistentry>
592 <term><varname>Restart=</varname></term>
593 <listitem><para>Configures whether the
594 service shall be restarted when the
595 service process exits, is killed,
596 or a timeout is reached. The service
597 process may be the main service
598 process, but also one of the processes
599 specified with
600 <varname>ExecStartPre=</varname>,
601 <varname>ExecStartPost=</varname>,
602 <varname>ExecStopPre=</varname>,
603 <varname>ExecStopPost=</varname>, or
604 <varname>ExecReload=</varname>.
605 When the death of the process is a
606 result of systemd operation (e.g. service
607 stop or restart), the service will not be
608 restarted. Timeouts include missing
609 the watchdog "keep-alive ping"
610 deadline and a service start, reload,
611 and stop operation timeouts.</para>
612
613 <para>Takes one of
614 <option>no</option>,
615 <option>on-success</option>,
616 <option>on-failure</option>,
617 <option>on-abort</option>, or
618 <option>always</option>. If set to
619 <option>no</option> (the default) the
620 service will not be restarted. If set to
621 <option>on-success</option> it will be
622 restarted only when the service process
623 exits cleanly.
624 In this context, a clean exit means
625 an exit code of 0, or one of the signals
626 <constant>SIGHUP</constant>, <constant>SIGINT</constant>, <constant>SIGTERM</constant>, or <constant>SIGPIPE</constant>, and
627 additionally, exit statuses and signals
628 specified in <varname>SuccessExitStatus=</varname>.
629 If set to <option>on-failure</option>
630 the service will be restarted when the
631 process exits with an nonzero exit code,
632 is terminated by a signal (including on
633 core dump), when an operation (such as
634 service reload) times out, and when the
635 configured watchdog timeout is triggered.
636 If set to
637 <option>on-abort</option> the service
638 will be restarted only if the service
639 process exits due to an uncaught
640 signal not specified as a clean exit
641 status.
642 If set to
643 <option>always</option> the service
644 will be restarted regardless whether
645 it exited cleanly or not, got
646 terminated abnormally by a signal or
647 hit a timeout.</para>
648
649 <para>In addition to the above settings,
650 the service will not be restarted if the
651 exit code or signal is specified in
652 <varname>RestartPreventExitStatus=</varname>
653 (see below).</para></listitem>
654 </varlistentry>
655
656 <varlistentry>
657 <term><varname>SuccessExitStatus=</varname></term>
658 <listitem><para>Takes a list of exit
659 status definitions that when returned
660 by the main service process will be
661 considered successful termination, in
662 addition to the normal successful exit
663 code 0 and the signals <constant>SIGHUP</constant>, <constant>SIGINT</constant>,
664 <constant>SIGTERM</constant> and <constant>SIGPIPE</constant>. Exit status
665 definitions can either be numeric exit
666 codes or termination signal names,
667 separated by spaces. Example:
668 <literal>SuccessExitStatus=1 2 8
669 <constant>SIGKILL</constant></literal>, ensures that exit
670 codes 1, 2, 8 and the termination
671 signal <constant>SIGKILL</constant> are considered clean
672 service terminations. This option may
673 appear more than once in which case
674 the list of successful exit statuses
675 is merged. If the empty string is
676 assigned to this option the list is
677 reset, all prior assignments of this
678 option will have no
679 effect.</para></listitem>
680 </varlistentry>
681
682 <varlistentry>
683 <term><varname>RestartPreventExitStatus=</varname></term>
684 <listitem><para>Takes a list of exit
685 status definitions that when returned
686 by the main service process will
687 prevent automatic service restarts
688 regardless of the restart setting
689 configured with
690 <varname>Restart=</varname>. Exit
691 status definitions can either be
692 numeric exit codes or termination
693 signal names, and are separated by
694 spaces. Defaults to the empty list, so
695 that by default no exit status is
696 excluded from the configured restart
697 logic. Example:
698 <literal>RestartPreventExitStatus=1 6
699 SIGABRT</literal>, ensures that exit
700 codes 1 and 6 and the termination
701 signal SIGABRT will not result in
702 automatic service restarting. This
703 option may appear more than once in
704 which case the list of restart preventing
705 statuses is merged. If the empty
706 string is assigned to this option the
707 list is reset, all prior assignments
708 of this option will have no
709 effect.</para></listitem>
710 </varlistentry>
711
712 <varlistentry>
713 <term><varname>PermissionsStartOnly=</varname></term>
714 <listitem><para>Takes a boolean
715 argument. If true, the permission
716 related execution options as
717 configured with
718 <varname>User=</varname> and similar
719 options (see
720 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
721 for more information) are only applied
722 to the process started with
723 <varname>ExecStart=</varname>, and not
724 to the various other
725 <varname>ExecStartPre=</varname>,
726 <varname>ExecStartPost=</varname>,
727 <varname>ExecReload=</varname>,
728 <varname>ExecStop=</varname>,
729 <varname>ExecStopPost=</varname>
730 commands. If false, the setting is
731 applied to all configured commands the
732 same way. Defaults to
733 false.</para></listitem>
734 </varlistentry>
735
736 <varlistentry>
737 <term><varname>RootDirectoryStartOnly=</varname></term>
738 <listitem><para>Takes a boolean
739 argument. If true, the root directory
740 as configured with the
741 <varname>RootDirectory=</varname>
742 option (see
743 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
744 for more information) is only applied
745 to the process started with
746 <varname>ExecStart=</varname>, and not
747 to the various other
748 <varname>ExecStartPre=</varname>,
749 <varname>ExecStartPost=</varname>,
750 <varname>ExecReload=</varname>,
751 <varname>ExecStop=</varname>,
752 <varname>ExecStopPost=</varname>
753 commands. If false, the setting is
754 applied to all configured commands the
755 same way. Defaults to
756 false.</para></listitem>
757 </varlistentry>
758
759 <varlistentry>
760 <term><varname>NonBlocking=</varname></term>
761 <listitem><para>Set O_NONBLOCK flag
762 for all file descriptors passed via
763 socket-based activation. If true, all
764 file descriptors >= 3 (i.e. all except
765 STDIN/STDOUT/STDERR) will have
766 the O_NONBLOCK flag set and hence are in
767 non-blocking mode. This option is only
768 useful in conjunction with a socket
769 unit, as described in
770 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Defaults
771 to false.</para></listitem>
772 </varlistentry>
773
774 <varlistentry>
775 <term><varname>NotifyAccess=</varname></term>
776 <listitem><para>Controls access to the
777 service status notification socket, as
778 accessible via the
779 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
780 call. Takes one of
781 <option>none</option> (the default),
782 <option>main</option> or
783 <option>all</option>. If
784 <option>none</option> no daemon status
785 updates are accepted from the service
786 processes, all status update messages
787 are ignored. If <option>main</option>
788 only service updates sent from the
789 main process of the service are
790 accepted. If <option>all</option> all
791 services updates from all members of
792 the service's control group are
793 accepted. This option should be set to
794 open access to the notification socket
795 when using
796 <varname>Type=notify</varname> or
797 <varname>WatchdogSec=</varname> (see
798 above). If those options are used but
799 <varname>NotifyAccess=</varname> not
800 configured it will be implicitly set
801 to
802 <option>main</option>.</para></listitem>
803 </varlistentry>
804
805 <varlistentry>
806 <term><varname>Sockets=</varname></term>
807 <listitem><para>Specifies the name of
808 the socket units this service shall
809 inherit the sockets from when the
810 service is started. Normally it
811 should not be necessary to use this
812 setting as all sockets whose unit
813 shares the same name as the service
814 (ignoring the different suffix of course)
815 are passed to the spawned
816 process.</para>
817
818 <para>Note that the same socket may be
819 passed to multiple processes at the
820 same time. Also note that a different
821 service may be activated on incoming
822 traffic than inherits the sockets. Or
823 in other words: the
824 <varname>Service=</varname> setting of
825 <filename>.socket</filename> units
826 does not have to match the inverse of
827 the <varname>Sockets=</varname>
828 setting of the
829 <filename>.service</filename> it
830 refers to.</para>
831
832 <para>This option may appear more than
833 once, in which case the list of socket
834 units is merged. If the empty string
835 is assigned to this option the list of
836 sockets is reset, all prior uses of
837 this setting will have no
838 effect.</para></listitem>
839 </varlistentry>
840
841 <varlistentry>
842 <term><varname>StartLimitInterval=</varname></term>
843 <term><varname>StartLimitBurst=</varname></term>
844
845 <listitem><para>Configure service
846 start rate limiting. By default
847 services which are started more often
848 than 5 times within 10s are not
849 permitted to start any more times
850 until the 10s interval ends. With
851 these two options this rate limiting
852 may be modified. Use
853 <varname>StartLimitInterval=</varname>
854 to configure the checking interval
855 (defaults to 10s, set to 0 to disable
856 any kind of rate limiting). Use
857 <varname>StartLimitBurst=</varname> to
858 configure how many starts per interval
859 are allowed (defaults to 5). These
860 configuration options are particularly
861 useful in conjunction with
862 <varname>Restart=</varname>, however
863 apply to all kinds of starts
864 (including manual), not just those
865 triggered by the
866 <varname>Restart=</varname> logic.
867 Note that units which are configured
868 for <varname>Restart=</varname> and
869 which reach the start limit are not
870 attempted to be restarted anymore,
871 however they may still be restarted
872 manually at a later point from which
873 point on the restart logic is again
874 activated. Note that
875 <command>systemctl
876 reset-failed</command> will cause the
877 restart rate counter for a service to
878 be flushed, which is useful if the
879 administrator wants to manually start
880 a service and the start limit
881 interferes with
882 that.</para></listitem>
883 </varlistentry>
884
885 <varlistentry>
886 <term><varname>StartLimitAction=</varname></term>
887
888 <listitem><para>Configure the action
889 to take if the rate limit configured
890 with
891 <varname>StartLimitInterval=</varname>
892 and
893 <varname>StartLimitBurst=</varname> is
894 hit. Takes one of
895 <option>none</option>,
896 <option>reboot</option>,
897 <option>reboot-force</option> or
898 <option>reboot-immediate</option>. If
899 <option>none</option> is set,
900 hitting the rate limit will trigger no
901 action besides that the start will not
902 be
903 permitted. <option>reboot</option>
904 causes a reboot following the normal
905 shutdown procedure (i.e. equivalent to
906 <command>systemctl reboot</command>),
907 <option>reboot-force</option> causes
908 an forced reboot which will terminate
909 all processes forcibly but should
910 cause no dirty file systems on reboot
911 (i.e. equivalent to <command>systemctl
912 reboot -f</command>) and
913 <option>reboot-immediate</option>
914 causes immediate execution of the
915 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
916 system call, which might result in
917 data loss. Defaults to
918 <option>none</option>.</para></listitem>
919 </varlistentry>
920
921 </variablelist>
922
923 <para>Check
924 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
925 and
926 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
927 for more settings.</para>
928
929 </refsect1>
930
931 <refsect1>
932 <title>Compatibility Options</title>
933
934 <para>The following options are also available in the
935 <literal>[Service]</literal> section, but exist purely
936 for compatibility reasons and should not be used in
937 newly written service files.</para>
938
939 <variablelist class='unit-directives'>
940 <varlistentry>
941 <term><varname>SysVStartPriority=</varname></term>
942 <listitem><para>Set the SysV start
943 priority to use to order this service
944 in relation to SysV services lacking
945 LSB headers. This option is only
946 necessary to fix ordering in relation
947 to legacy SysV services, that have no
948 ordering information encoded in the
949 script headers. As such it should only
950 be used as temporary compatibility
951 option, and not be used in new unit
952 files. Almost always it is a better
953 choice to add explicit ordering
954 directives via
955 <varname>After=</varname> or
956 <varname>Before=</varname>,
957 instead. For more details see
958 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
959 used, pass an integer value in the
960 range 0-99.</para></listitem>
961 </varlistentry>
962
963 <varlistentry>
964 <term><varname>FsckPassNo=</varname></term>
965 <listitem><para>Set the fsck passno
966 priority to use to order this service
967 in relation to other file system
968 checking services. This option is only
969 necessary to fix ordering in relation
970 to fsck jobs automatically created for
971 all <filename>/etc/fstab</filename>
972 entries with a value in the fs_passno
973 column > 0. As such it should only be
974 used as option for fsck
975 services. Almost always it is a better
976 choice to add explicit ordering
977 directives via
978 <varname>After=</varname> or
979 <varname>Before=</varname>,
980 instead. For more details see
981 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
982 used, pass an integer value in the
983 same range as
984 <filename>/etc/fstab</filename>'s
985 fs_passno column. See
986 <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
987 for details.</para></listitem>
988 </varlistentry>
989
990 </variablelist>
991 </refsect1>
992
993 <refsect1>
994 <title>See Also</title>
995 <para>
996 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
997 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
998 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
999 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1000 <citerefentry><refentrytitle>systemd.cgroup</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1001 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1002 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1003 </para>
1004 </refsect1>
1005
1006 </refentry>